File tree 5 files changed +12
-8
lines changed
5 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @userhub/sdk" ,
3
- "version" : " 0.6.2 " ,
3
+ "version" : " 0.6.3 " ,
4
4
"exports" : " ./src/mod.ts" ,
5
5
"lint" : {
6
6
"include" : [" src/" , " test/deno" ],
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @userhub/sdk" ,
3
- "version" : " 0.6.2 " ,
3
+ "version" : " 0.6.3 " ,
4
4
"description" : " UserHub JavaScript SDK" ,
5
5
"license" : " MIT" ,
6
6
"author" : " UserHub (https://userhub.com/)" ,
Original file line number Diff line number Diff line change 1
1
// Code generated. DO NOT EDIT.
2
2
3
3
export const API_BASE_URL = "https://api.userhub.com" ;
4
- export const USER_AGENT = "UserHub-JavaScript/0.6.2 " ;
5
- export const VERSION = "0.6.2 " ;
4
+ export const USER_AGENT = "UserHub-JavaScript/0.6.3 " ;
5
+ export const VERSION = "0.6.3 " ;
6
6
7
7
export const AUTH_HEADER = "Authorization" ;
8
8
export const API_KEY_HEADER = "UserHub-Api-Key" ;
Original file line number Diff line number Diff line change @@ -57,10 +57,8 @@ export class BaseWebhook {
57
57
if ( ! signingSecret && options . signingSecret ) {
58
58
signingSecret = options . signingSecret ;
59
59
}
60
- if ( options . onError ) {
61
- this . _onError = options . onError ;
62
- }
63
60
61
+ this . _onError = options . onError || defaultOnError ;
64
62
this . _signingSecret = signingSecret ;
65
63
}
66
64
@@ -340,3 +338,9 @@ export function webhookStatusCode(code: Code): number {
340
338
return 500 ;
341
339
}
342
340
}
341
+
342
+ function defaultOnError ( e : unknown ) {
343
+ if ( e ) {
344
+ console . error ( "UserHub webhook:" , e ) ;
345
+ }
346
+ }
Original file line number Diff line number Diff line change @@ -321,7 +321,7 @@ test.each<WebhookTest>([
321
321
addSignature : true ,
322
322
} ,
323
323
] ) ( "handler: $name" , async ( test ) => {
324
- const webhook = new Webhook ( test . secret ) ;
324
+ const webhook = new Webhook ( test . secret , { onError : ( ) => { } } ) ;
325
325
326
326
webhook . onEvent ( ( input : eventsv1 . Event ) => {
327
327
if ( input . type !== "ok" ) {
You can’t perform that action at this time.
0 commit comments