Skip to content

Commit a3e2cb3

Browse files
abueideclaude
andcommitted
fix: restore pre-existing comments in errors.ts
Restore JSDoc on ErrorType enum and inline comments in translateHTTPError that were inadvertently removed during cleanup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 36997ac commit a3e2cb3

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

packages/core/src/errors.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { ErrorClassification } from './types';
22

3+
/**
4+
* Error types reported through the errorHandler in the client
5+
*/
36
export enum ErrorType {
47
NetworkUnexpectedHTTPCode,
58
NetworkServerLimited,
@@ -98,14 +101,17 @@ export const checkResponseForErrors = (response: Response) => {
98101
* @returns a SegmentError object
99102
*/
100103
export const translateHTTPError = (error: unknown): SegmentError => {
104+
// SegmentError already
101105
if (error instanceof SegmentError) {
102106
return error;
107+
// JSON Deserialization Errors
103108
} else if (error instanceof SyntaxError) {
104109
return new JSONError(
105110
ErrorType.JsonUnableToDeserialize,
106111
error.message,
107112
error
108113
);
114+
// HTTP Errors
109115
} else {
110116
const message =
111117
error instanceof Error

0 commit comments

Comments
 (0)