Use assertReturn to cleanup (#2804)
* Use assertReturn to cleanup * Remove Uint/Int duplication * Adjust * ws errors, part 2 * . * Adj. manual * adj * switchMap * Revert "switchMap" This reverts commit edfa4a2258f09042b61a27fd3812f0c53039fe4f. * Revert. * Revert. * protected constructor * Correct isHexJson flag * Remove isHexJson (always detect) * Adjust * Flags
This commit is contained in:
@@ -22,20 +22,22 @@ const known: Record<number, string> = {
|
||||
1015: 'TLS Handshake'
|
||||
};
|
||||
|
||||
function getUnmapped (code: number): string | void {
|
||||
if (code <= 1999) {
|
||||
return '(For WebSocket standard)';
|
||||
} else if (code <= 2999) {
|
||||
return '(For WebSocket extensions)';
|
||||
} else if (code <= 3999) {
|
||||
return '(For libraries and frameworks)';
|
||||
} else if (code <= 4999) {
|
||||
return '(For applications)';
|
||||
}
|
||||
}
|
||||
|
||||
export function getWSErrorString (code: number): string {
|
||||
if (code >= 0 && code <= 999) {
|
||||
return '(Unused)';
|
||||
} else if (code >= 1016) {
|
||||
if (code <= 1999) {
|
||||
return '(For WebSocket standard)';
|
||||
} else if (code <= 2999) {
|
||||
return '(For WebSocket extensions)';
|
||||
} else if (code <= 3999) {
|
||||
return '(For libraries and frameworks)';
|
||||
} else if (code <= 4999) {
|
||||
return '(For applications)';
|
||||
}
|
||||
}
|
||||
|
||||
return known[code] || '(Unknown)';
|
||||
return known[code] || getUnmapped(code) || '(Unknown)';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user