File tree 3 files changed +9
-8
lines changed 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 1
1
node_modules
2
2
dist
3
+ .idea
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ export function parseBoolean(val: string | undefined | null): boolean {
43
43
case 'no' :
44
44
return false ;
45
45
default :
46
- throw new Error ( `Cannot parse boolean from " ${ val } " ` ) ;
46
+ throw new Error ( `Cannot parse boolean` ) ;
47
47
}
48
48
}
49
49
@@ -64,10 +64,10 @@ export function hexToBuffer(hex: string): Buffer {
64
64
return Buffer . alloc ( 0 ) ;
65
65
}
66
66
if ( ! hex . startsWith ( '0x' ) ) {
67
- throw new Error ( `Hex string is missing the "0x" prefix: " ${ hex } " ` ) ;
67
+ throw new Error ( `Hex string is missing the "0x" prefix` ) ;
68
68
}
69
69
if ( hex . length % 2 !== 0 ) {
70
- throw new Error ( `Hex string is an odd number of digits: ${ hex } ` ) ;
70
+ throw new Error ( `Hex string is an odd number of digits` ) ;
71
71
}
72
72
return Buffer . from ( hex . substring ( 2 ) , 'hex' ) ;
73
73
}
@@ -82,10 +82,10 @@ export function coerceToBuffer(hex: string | Buffer | ArrayBufferView): Buffer {
82
82
hex = hex . substring ( 2 ) ;
83
83
}
84
84
if ( hex . length % 2 !== 0 ) {
85
- throw new Error ( `Hex string is an odd number of characters: ${ hex } ` ) ;
85
+ throw new Error ( `Hex string is an odd number of characters` ) ;
86
86
}
87
87
if ( ! / ^ [ 0 - 9 a - f A - F ] * $ / . test ( hex ) ) {
88
- throw new Error ( `Hex string contains non-hexadecimal characters: ${ hex } ` ) ;
88
+ throw new Error ( `Hex string contains non-hexadecimal characters` ) ;
89
89
}
90
90
return Buffer . from ( hex , 'hex' ) ;
91
91
} else if ( Buffer . isBuffer ( hex ) ) {
Original file line number Diff line number Diff line change @@ -11,19 +11,19 @@ export const PG_TYPE_MAPPINGS = {
11
11
if ( / ^ ( 0 x | 0 X ) [ a - f A - F 0 - 9 ] * $ / . test ( x ) ) {
12
12
// hex string with "0x" prefix
13
13
if ( x . length % 2 !== 0 ) {
14
- throw new Error ( `Hex string is an odd number of digits: " ${ x } " ` ) ;
14
+ throw new Error ( `Hex string is an odd number of digits` ) ;
15
15
}
16
16
return '\\x' + x . slice ( 2 ) ;
17
17
} else if ( x . length === 0 ) {
18
18
return '\\x' ;
19
19
} else if ( / ^ \\ x [ a - f A - F 0 - 9 ] * $ / . test ( x ) ) {
20
20
// hex string with "\x" prefix (already encoded for postgres)
21
21
if ( x . length % 2 !== 0 ) {
22
- throw new Error ( `Hex string is an odd number of digits: " ${ x } " ` ) ;
22
+ throw new Error ( `Hex string is an odd number of digits` ) ;
23
23
}
24
24
return x ;
25
25
} else {
26
- throw new Error ( `String value for bytea column does not have 0x prefix: " ${ x } " ` ) ;
26
+ throw new Error ( `String value for bytea column does not have 0x prefix` ) ;
27
27
}
28
28
} else if ( Buffer . isBuffer ( x ) ) {
29
29
return '\\x' + x . toString ( 'hex' ) ;
You can’t perform that action at this time.
0 commit comments