172172 return this . _callback ;
173173 } ,
174174 /**
175- * Post to exceptions.js server
176- * @param {bool } Return the current option if undefined. Enable the postToExceptionsJsServer option
177- * if enable is true. Disable the postToExceptionsJsServer option if enable is false.
178- * @return Options object if enable is defined, value of the postToExceptionsJsServer option if
175+ * Post to exceptions.js platform
176+ * @param {bool } Return the current option if undefined. Enable the postToExceptionsJsPlatform option
177+ * if enable is true. Disable the postToExceptionsJsPlatform option if enable is false.
178+ * @return Options object if enable is defined, value of the postToExceptionsJsPlatform option if
179179 * enable is not defined.
180180 */
181- postToExceptionsJsServer : function ( enable ) {
181+ postToExceptionsJsPlatform : function ( enable ) {
182182 if ( enable !== undefined ) {
183- this . _postToExceptionsJsServer = Boolean ( enable ) ;
183+ this . _postToExceptionsJsPlatform = Boolean ( enable ) ;
184184 return this ;
185185 }
186- return this . _postToExceptionsJsServer ;
186+ return this . _postToExceptionsJsPlatform ;
187187 } ,
188188 /**
189189 * Toggle all options according to the enable parameter
195195 . screenshot ( enable )
196196 . post ( enable )
197197 . callback ( enable )
198- . postToExceptionsJsServer ( enable ) ;
198+ . postToExceptionsJsPlatform ( enable ) ;
199199 }
200200 } ;
201201
226226 return config . exception ;
227227 }
228228
229- createCustomException . _createThrowIf = function ( exception ) {
229+ createCustomException . _createThrowIf = function ( Exception ) {
230230 /**
231231 * Throw an exception if the condition is true.
232232 * @function throwIf
236236 */
237237 return function throwIf ( condition , message ) {
238238 if ( condition ) {
239- var except = new exception ( message || "Condition evaluated to truthy" ) ;
239+ var except = new Exception ( message || "Condition evaluated to truthy" ) ;
240240 throw except ;
241241 }
242242 } ;
243243 } ;
244244
245- createCustomException . _createReportIf = function ( exception ) {
245+ createCustomException . _createReportIf = function ( Exception ) {
246246 /**
247247 * Report an exception if the condition is true.
248248 * @function reportIf
252252 */
253253 return function reportIf ( condition , message ) {
254254 if ( condition ) {
255- var except = new exception ( message || "Condition evaluated to truthy" ) ;
255+ var except = new Exception ( message || "Condition evaluated to truthy" ) ;
256256 except . report ( ) ;
257257 }
258258 } ;
520520 if ( this . _guardedOptions . post ( ) ) {
521521 this . _post ( ) ;
522522 }
523- if ( this . _guardedOptions . postToExceptionsJsServer ( ) ) {
524- this . _postToExceptionsJsServer ( ) ;
523+ if ( this . _guardedOptions . postToExceptionsJsPlatform ( ) ) {
524+ this . _postToExceptionsJsPlatform ( ) ;
525525 }
526526 if ( this . _guardedOptions . callback ( ) ) {
527527 this . _callback ( ) ;
528528 }
529529 handler . _pushReportedException ( this ) ;
530- console . log ( "exceptions.js: " + this . toString ( ) ) ;
530+ console . log ( "exceptions.js exception : " + this . toString ( ) ) ;
531531 console . log ( this . toSerializableObject ( ) ) ;
532532 } ,
533533 _retrieveStacktrace : function ( ) {
590590 http . setRequestHeader ( "Content-type" , "application/x-www-form-urlencoded; charset=UTF-8" ) ;
591591 http . send ( "exception=" + encodeURIComponent ( jsonString ) ) ;
592592 } ,
593- _postToExceptionsJsServer : function ( ) {
593+ _postToExceptionsJsPlatform : function ( ) {
594594 var http = new window . XMLHttpRequest ( ) ,
595595 postHeaders = exceptions . handler . postHeaders ( ) ,
596596 jsonString = this . toJSONString ( ) ,
602602 //Send the proper header information along with the request
603603 http . setRequestHeader ( "Content-type" , "application/x-www-form-urlencoded; charset=UTF-8" ) ;
604604 http . send ( "exception=" + encodeURIComponent ( jsonString ) +
605- "&clientId=" + encodeURIComponent ( clientId ) +
606- "&to=" + encodeURIComponent ( to ) ) ;
605+ "&clientId=" + encodeURIComponent ( clientId ) +
606+ "&to=" + encodeURIComponent ( to ) ) ;
607607 } ,
608608 _callback : function ( ) {
609609 var callback = exceptions . handler . callback ( ) ;
765765 o . callback ( false ) ;
766766 }
767767 if ( ! exceptions . handler . clientId ( ) ) {
768- o . postToExceptionsJsServer ( false ) ;
768+ o . postToExceptionsJsPlatform ( false ) ;
769769 }
770770 return o ;
771771 } ,
837837 _reportedExceptions : [ ] ,
838838 _clientId : null ,
839839 _to : null ,
840- _postToExceptionsJsServer : false ,
841840
842841 /**
843842 * Scope options for the handler. Options are none, exceptions, and all. Setting the scope to none signals that the handler
940939 }
941940 } ,
942941
943- postToExceptionsJsServer : function ( enable , clientId , to ) {
944- if ( enable !== undefined ) {
945- if ( enable ) {
946- handler . clientId ( clientId ) ;
947- }
948- if ( to ) {
949- handler . to ( to ) ;
950- }
951- handler . _postToExceptionsJsServer = enable ;
952- return handler ;
953- }
954- return handler . _postToExceptionsJsServer && handler . clientId ( ) ;
955-
942+ /**
943+ * Enable posting to exceptionsjs platform. The exceptionsjs platform handles
944+ * your Javascript error by parsing the serialized exception and constructing a
945+ * useful exception email that includes stacktraces, screenshots, and extra information.
946+ * Register for exceptionsjs platform at https://exceptionsjs.com. This option only works
947+ * if you've enabled the option to allow unsecure reporting. If you have enabled secure
948+ * reporting you must send your exceptions to excpetionsjs platform using the full oauth2
949+ * process. See https://exceptionsjs.com for useful libraries in many languages that make
950+ * submitting exceptions with the full oauth2 process easy.
951+ * @param {string } clientId that will be used with exceptionsjs platform
952+ * @param {string } post request url
953+ * @return Handler if postUrl is defined. Url for post request if postUrl is not defined.
954+ */
955+ postToExceptionsJsPlatform : function ( clientId , to ) {
956+ if ( clientId !== undefined ) {
957+ handler . clientId ( clientId ) ;
958+ if ( to ) {
959+ handler . to ( to ) ;
960+ }
961+ return handler ;
962+ }
963+ return handler . clientId ( ) ;
964+
956965 } ,
957966
958967 clientId : function ( clientId ) {
959- if ( clientId ) {
960- handler . _clientId = clientId ;
961- return handler ;
962- }
963- return handler . _clientId ;
968+ if ( clientId ) {
969+ handler . _clientId = clientId ;
970+ return handler ;
971+ }
972+ return handler . _clientId ;
964973 } ,
965974
966975 to : function ( to ) {
967- if ( to ) {
968- handler . _to = to ;
969- return handler ;
970- }
971- return handler . _to ;
976+ if ( to ) {
977+ handler . _to = to ;
978+ return handler ;
979+ }
980+ return handler . _to ;
972981 } ,
973982
974983 /**
10421051 } ,
10431052
10441053 _setup : function ( ) {
1045- handler
1046- . _setupDefaultGuard ( )
1047- . _setupOnError ( )
1048- . stacktraceUrl ( "http://cdnjs.cloudflare.com/ajax/libs/stacktrace.js/0.6.0/stacktrace.js" )
1049- . html2canvasUrl ( "http://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js" )
1054+ handler
1055+ . _setupDefaultGuard ( )
1056+ . _setupOnError ( )
1057+ . stacktraceUrl ( "http://cdnjs.cloudflare.com/ajax/libs/stacktrace.js/0.6.0/stacktrace.js" )
1058+ . html2canvasUrl ( "http://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js" ) ;
10501059 } ,
10511060
10521061 _setupOnError : function ( ) {
10671076 _setupDefaultGuard : function ( ) {
10681077 handler . guard ( function ( g ) {
10691078 return g . restrictByExceptionsCount ( 10 , 10 )
1070- . restrictByExceptionsCount ( 20 ) ;
1079+ . restrictByExceptionsCount ( 20 ) ;
10711080 } ) ;
10721081 return handler ;
10731082 } ,
11821191 } ;
11831192
11841193 window . exceptions = exceptions ;
1185- } ( ) ) ;
1194+ } ( ) ) ;
0 commit comments