@@ -107,6 +107,8 @@ Raven.prototype = {
107
107
} ) ;
108
108
}
109
109
110
+ this . _dsn = dsn ;
111
+
110
112
// "Script error." is hard coded into browsers for errors that it can't read.
111
113
// this is the result of a script being pulled in from an external domain and CORS.
112
114
this . _globalOptions . ignoreErrors . push ( / ^ S c r i p t e r r o r \. ? $ / ) ;
@@ -123,12 +125,13 @@ Raven.prototype = {
123
125
124
126
// assemble the endpoint from the uri pieces
125
127
this . _globalServer = '//' + uri . host +
126
- ( uri . port ? ':' + uri . port : '' ) +
127
- '/' + path + 'api/' + this . _globalProject + '/store/' ;
128
+ ( uri . port ? ':' + uri . port : '' ) ;
128
129
129
130
if ( uri . protocol ) {
130
131
this . _globalServer = uri . protocol + ':' + this . _globalServer ;
131
132
}
133
+ this . _globalEndpoint = this . _globalServer +
134
+ '/' + path + 'api/' + this . _globalProject + '/store/' ;
132
135
133
136
if ( this . _globalOptions . fetchContext ) {
134
137
TraceKit . remoteFetching = true ;
@@ -498,6 +501,35 @@ Raven.prototype = {
498
501
}
499
502
} ,
500
503
504
+ showReportDialog : function ( options ) {
505
+ if ( ! window . document ) // doesn't work without a document (React native)
506
+ return ;
507
+
508
+ options = options || { } ;
509
+
510
+ var lastEventId = options . eventId || this . lastEventId ( ) ;
511
+ if ( ! lastEventId )
512
+ return ;
513
+
514
+ var encode = encodeURIComponent ;
515
+ var qs = '' ;
516
+ qs += '?eventId=' + encode ( lastEventId ) ;
517
+ qs += '&dsn=' + encode ( this . _dsn || '' ) ;
518
+
519
+ var user = this . _globalContext . user ;
520
+ if ( user ) {
521
+ if ( user . name )
522
+ qs += '&name=' + encode ( user . name ) ;
523
+ if ( user . email )
524
+ qs += '&email=' + encode ( user . email ) ;
525
+ }
526
+
527
+ var script = document . createElement ( 'script' ) ;
528
+ script . async = true ;
529
+ script . src = this . _globalServer + '/api/embed/error-page/' + qs ;
530
+ ( document . getElementsByTagName ( 'body' ) [ 0 ] ) . appendChild ( script ) ;
531
+ } ,
532
+
501
533
/**** Private functions ****/
502
534
_ignoreNextOnError : function ( ) {
503
535
var self = this ;
@@ -933,8 +965,9 @@ Raven.prototype = {
933
965
934
966
if ( ! this . isSetup ( ) ) return ;
935
967
968
+ var url = this . _globalEndpoint ;
936
969
( globalOptions . transport || this . _makeRequest ) . call ( this , {
937
- url : this . _globalServer ,
970
+ url : url ,
938
971
auth : {
939
972
sentry_version : '7' ,
940
973
sentry_client : 'raven-js/' + this . VERSION ,
@@ -945,13 +978,13 @@ Raven.prototype = {
945
978
onSuccess : function success ( ) {
946
979
self . _triggerEvent ( 'success' , {
947
980
data : data ,
948
- src : self . _globalServer
981
+ src : url
949
982
} ) ;
950
983
} ,
951
984
onError : function failure ( ) {
952
985
self . _triggerEvent ( 'failure' , {
953
986
data : data ,
954
- src : self . _globalServer
987
+ src : url
955
988
} ) ;
956
989
}
957
990
} ) ;
0 commit comments