@@ -55,12 +55,14 @@ export function handlerSetup(
5555 * application code.
5656 * @param {Any|ErrorMessage } err - error information of any type or content.
5757 * This can be of any type but by giving an instance of ErrorMessage as the
58- * error arugment one can manually provide values to all fields of the
58+ * error argument one can manually provide values to all fields of the
5959 * potential payload.
6060 * @param {Object } [request] - an object containing request information. This
6161 * is expected to be an object similar to the Node/Express request object.
62- * @param {String } [additionalMessage] - a string containing error message
63- * information to override the builtin message given by an Error/Exception
62+ * @param {String } [customMessage] - an optional error message string that
63+ * overrides the default message & stack trace. Message format must comply
64+ * with message field requirements defined in the documentation:
65+ * https://cloud.google.com/error-reporting/reference/rest/v1beta1/projects.events/report#reportederrorevent
6466 * @param {Function } [callback] - a callback to be invoked once the message
6567 * has been successfully submitted to the error reporting API or has failed
6668 * after four attempts with the success or error response.
@@ -71,7 +73,7 @@ export function handlerSetup(
7173 function reportManualError ( err : AnyError , request : Request ) : ErrorMessage ;
7274 function reportManualError (
7375 err : AnyError ,
74- additionalMessage : string
76+ customMessage : string
7577 ) : ErrorMessage ;
7678 function reportManualError ( err : AnyError , callback : Callback ) : ErrorMessage ;
7779 function reportManualError (
@@ -82,41 +84,41 @@ export function handlerSetup(
8284 function reportManualError (
8385 err : AnyError ,
8486 request : Request ,
85- additionalMessage : string
87+ customMessage : string
8688 ) : ErrorMessage ;
8789 function reportManualError (
8890 err : AnyError ,
89- additionalMessage : string ,
91+ customMessage : string ,
9092 callback : Callback
9193 ) : ErrorMessage ;
9294 function reportManualError (
9395 err : AnyError ,
9496 request : Request ,
95- additionalMessage : string ,
97+ customMessage : string ,
9698 callback : Callback
9799 ) : ErrorMessage ;
98100 function reportManualError (
99101 err : AnyError ,
100102 request ?: Request | Callback | string ,
101- additionalMessage ?: Callback | string | { } ,
103+ customMessage ?: Callback | string ,
102104 callback ?: Callback | { } | string
103105 ) : ErrorMessage {
104106 let em ;
105107 if ( is . string ( request ) ) {
106108 // no request given
107- callback = additionalMessage ;
108- additionalMessage = request ;
109+ callback = customMessage ;
110+ customMessage = request as string ;
109111 request = undefined ;
110112 } else if ( is . function ( request ) ) {
111- // neither request nor additionalMessage given
113+ // neither request nor customMessage given
112114 callback = request ;
113115 request = undefined ;
114- additionalMessage = undefined ;
116+ customMessage = undefined ;
115117 }
116118
117- if ( is . function ( additionalMessage ) ) {
118- callback = additionalMessage ;
119- additionalMessage = undefined ;
119+ if ( is . function ( customMessage ) ) {
120+ callback = customMessage ;
121+ customMessage = undefined ;
120122 }
121123
122124 if ( err instanceof ErrorMessage ) {
@@ -157,8 +159,8 @@ export function handlerSetup(
157159 ) ;
158160 }
159161
160- if ( is . string ( additionalMessage ) ) {
161- em . setMessage ( additionalMessage as string ) ;
162+ if ( is . string ( customMessage ) ) {
163+ em . setMessage ( customMessage as string ) ;
162164 }
163165
164166 // TODO: Address this type cast
0 commit comments