@superblocksteam/sabs-client 0.419.0 → 0.422.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/errors.ts DELETED
@@ -1,60 +0,0 @@
1
- import {
2
- BadRequestError,
3
- InternalServerError,
4
- NotFoundError,
5
- ConflictError,
6
- UnauthorizedError,
7
- ForbiddenError,
8
- HttpError
9
- } from '@superblocksteam/shared';
10
-
11
- // Re-export all error types from @superblocksteam/shared for convenience
12
- export { BadRequestError, InternalServerError, NotFoundError, ConflictError, UnauthorizedError, ForbiddenError, HttpError };
13
-
14
- /**
15
- * Internal factory function to create appropriate error types based on HTTP status codes
16
- * @internal
17
- */
18
- export function createErrorFromStatusCode(statusCode: number, message: string): Error {
19
- const baseMessage = `SABS API Error (${statusCode}): ${message}`;
20
-
21
- switch (statusCode) {
22
- case 400:
23
- return new BadRequestError(baseMessage);
24
- case 401:
25
- return new UnauthorizedError(baseMessage);
26
- case 403:
27
- return new ForbiddenError(baseMessage);
28
- case 404:
29
- return new NotFoundError(baseMessage);
30
- case 409:
31
- return new ConflictError(baseMessage);
32
- case 500:
33
- case 502:
34
- case 503:
35
- case 504:
36
- return new InternalServerError(baseMessage);
37
- default:
38
- // For any other status codes, use the generic HttpError
39
- return new HttpError(statusCode, baseMessage);
40
- }
41
- }
42
-
43
- /**
44
- * Internal function to create a client-side error (treated as BadRequestError with 400 status)
45
- * @internal
46
- */
47
- export function createClientError(message: string): BadRequestError {
48
- return new BadRequestError(`SABS Client Error: ${message}`);
49
- }
50
-
51
- /**
52
- * Internal function to create a network/unknown error (treated as InternalServerError with 500 status)
53
- * @internal
54
- */
55
- export function createNetworkError(message: string, originalError?: Error): InternalServerError {
56
- const errorMessage = originalError
57
- ? `SABS Network Error: ${message} (caused by: ${originalError.message})`
58
- : `SABS Network Error: ${message}`;
59
- return new InternalServerError(errorMessage);
60
- }
package/src/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './sabs';
2
- export { BadRequestError, InternalServerError, NotFoundError, ConflictError, UnauthorizedError, ForbiddenError, HttpError } from './errors';