@povio/openapi-codegen-cli 3.1.0-rc.7 → 3.1.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/dist/acl.d.mts +1 -1
- package/dist/acl.mjs +1 -1
- package/dist/{error-handling-BeRxGbwE.d.mts → error-handling-D-mHJ60d.d.mts} +2 -0
- package/dist/{error-handling-DG8SfTWB.mjs → error-handling-DSI86D3u.mjs} +7 -4
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/sh.mjs +1 -1
- package/dist/zod.d.mts +1 -1
- package/dist/zod.mjs +1 -1
- package/package.json +1 -1
package/dist/acl.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ErrorHandler } from "./error-handling-
|
|
1
|
+
import { a as ErrorHandler } from "./error-handling-D-mHJ60d.mjs";
|
|
2
2
|
import * as react from "react";
|
|
3
3
|
import { PropsWithChildren } from "react";
|
|
4
4
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
package/dist/acl.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as SharedErrorHandler } from "./error-handling-
|
|
1
|
+
import { i as SharedErrorHandler } from "./error-handling-DSI86D3u.mjs";
|
|
2
2
|
import { n as OpenApiRouter, t as AuthContext } from "./auth.context-Bu5KW2sI.mjs";
|
|
3
3
|
import { createContext, useCallback, useEffect, useState } from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -74,6 +74,8 @@ declare class ErrorHandler<CodeT extends string | number> {
|
|
|
74
74
|
onRethrowError
|
|
75
75
|
}: ErrorHandlerOptions<CodeT>);
|
|
76
76
|
private matchesEntry;
|
|
77
|
+
/** Lazy so resolveT() only runs when getMessage actually uses `t`. */
|
|
78
|
+
private static lazyT;
|
|
77
79
|
rethrowError(error: unknown): ApplicationException<CodeT | GeneralErrorCodes>;
|
|
78
80
|
getError(error: unknown): ApplicationException<CodeT | GeneralErrorCodes> | null;
|
|
79
81
|
getErrorCode(error: unknown): CodeT | GeneralErrorCodes | null;
|
|
@@ -97,7 +97,7 @@ var DomainErrorRegistry = class {
|
|
|
97
97
|
return this.entries.get(code);
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
|
-
var ErrorHandler = class {
|
|
100
|
+
var ErrorHandler = class ErrorHandler {
|
|
101
101
|
entries = [];
|
|
102
102
|
userEntries;
|
|
103
103
|
generalEntries;
|
|
@@ -164,25 +164,28 @@ var ErrorHandler = class {
|
|
|
164
164
|
if (entry.condition) return entry.condition(error);
|
|
165
165
|
return code === entry.code;
|
|
166
166
|
}
|
|
167
|
+
/** Lazy so resolveT() only runs when getMessage actually uses `t`. */
|
|
168
|
+
static lazyT = (key, options) => resolveT()(key, options);
|
|
167
169
|
rethrowError(error) {
|
|
168
170
|
const code = RestUtils.extractServerResponseCode(error);
|
|
169
171
|
const serverMessage = RestUtils.extractServerErrorMessage(error);
|
|
172
|
+
const t = ErrorHandler.lazyT;
|
|
170
173
|
const userEntry = this.userEntries.find((entry) => this.matchesEntry(error, entry, code));
|
|
171
174
|
if (userEntry) {
|
|
172
|
-
const exception = new ApplicationException(userEntry.getMessage(
|
|
175
|
+
const exception = new ApplicationException(userEntry.getMessage(t, error), userEntry.code, serverMessage);
|
|
173
176
|
this.onRethrowError?.(error, exception);
|
|
174
177
|
throw exception;
|
|
175
178
|
}
|
|
176
179
|
if (code !== null) {
|
|
177
180
|
const registryEntry = DomainErrorRegistry.getEntry(code);
|
|
178
181
|
if (registryEntry && (!registryEntry.condition || registryEntry.condition(error))) {
|
|
179
|
-
const exception = new ApplicationException(registryEntry.getMessage(
|
|
182
|
+
const exception = new ApplicationException(registryEntry.getMessage(t, error), registryEntry.code, serverMessage);
|
|
180
183
|
this.onRethrowError?.(error, exception);
|
|
181
184
|
throw exception;
|
|
182
185
|
}
|
|
183
186
|
}
|
|
184
187
|
const generalEntry = this.generalEntries.find((entry) => this.matchesEntry(error, entry, code));
|
|
185
|
-
const exception = new ApplicationException(generalEntry.getMessage(
|
|
188
|
+
const exception = new ApplicationException(generalEntry.getMessage(t, error), generalEntry.code, serverMessage);
|
|
186
189
|
this.onRethrowError?.(error, exception);
|
|
187
190
|
throw exception;
|
|
188
191
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ErrorHandler, c as SharedErrorHandler, d as ns, f as resources, i as ErrorEntry, l as TranslateFunction, n as DomainErrorEntry, o as ErrorHandlerOptions, r as DomainErrorRegistry, s as GeneralErrorCodes, t as ApplicationException, u as configureTranslations } from "./error-handling-
|
|
1
|
+
import { a as ErrorHandler, c as SharedErrorHandler, d as ns, f as resources, i as ErrorEntry, l as TranslateFunction, n as DomainErrorEntry, o as ErrorHandlerOptions, r as DomainErrorRegistry, s as GeneralErrorCodes, t as ApplicationException, u as configureTranslations } from "./error-handling-D-mHJ60d.mjs";
|
|
2
2
|
import "./options-CE4Koxof.mjs";
|
|
3
3
|
import { t as OpenAPICodegenConfig } from "./config-BU7wVf7U.mjs";
|
|
4
4
|
import { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosResponseHeaders, CreateAxiosDefaults } from "axios";
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as RestUtils, c as resources, i as SharedErrorHandler, n as DomainErrorRegistry, o as configureTranslations, r as ErrorHandler, s as ns, t as ApplicationException } from "./error-handling-
|
|
1
|
+
import { a as RestUtils, c as resources, i as SharedErrorHandler, n as DomainErrorRegistry, o as configureTranslations, r as ErrorHandler, s as ns, t as ApplicationException } from "./error-handling-DSI86D3u.mjs";
|
|
2
2
|
import { n as OpenApiRouter, t as AuthContext } from "./auth.context-Bu5KW2sI.mjs";
|
|
3
3
|
import axios from "axios";
|
|
4
4
|
import { z } from "zod";
|
package/dist/sh.mjs
CHANGED
package/dist/zod.d.mts
CHANGED
package/dist/zod.mjs
CHANGED
package/package.json
CHANGED