|
|
"use strict"; |
|
|
Object.defineProperty(exports, "__esModule", { value: true }); |
|
|
exports.InferenceClientProviderOutputError = exports.InferenceClientHubApiError = exports.InferenceClientProviderApiError = exports.InferenceClientInputError = exports.InferenceClientError = void 0; |
|
|
|
|
|
|
|
|
|
|
|
class InferenceClientError extends Error { |
|
|
constructor(message) { |
|
|
super(message); |
|
|
this.name = "InferenceClientError"; |
|
|
} |
|
|
} |
|
|
exports.InferenceClientError = InferenceClientError; |
|
|
class InferenceClientInputError extends InferenceClientError { |
|
|
constructor(message) { |
|
|
super(message); |
|
|
this.name = "InputError"; |
|
|
} |
|
|
} |
|
|
exports.InferenceClientInputError = InferenceClientInputError; |
|
|
class InferenceClientHttpRequestError extends InferenceClientError { |
|
|
httpRequest; |
|
|
httpResponse; |
|
|
constructor(message, httpRequest, httpResponse) { |
|
|
super(message); |
|
|
this.httpRequest = { |
|
|
...httpRequest, |
|
|
...(httpRequest.headers |
|
|
? { |
|
|
headers: { |
|
|
...httpRequest.headers, |
|
|
...("Authorization" in httpRequest.headers ? { Authorization: `Bearer [redacted]` } : undefined), |
|
|
|
|
|
}, |
|
|
} |
|
|
: undefined), |
|
|
}; |
|
|
this.httpResponse = httpResponse; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class InferenceClientProviderApiError extends InferenceClientHttpRequestError { |
|
|
constructor(message, httpRequest, httpResponse) { |
|
|
super(message, httpRequest, httpResponse); |
|
|
this.name = "ProviderApiError"; |
|
|
} |
|
|
} |
|
|
exports.InferenceClientProviderApiError = InferenceClientProviderApiError; |
|
|
|
|
|
|
|
|
|
|
|
class InferenceClientHubApiError extends InferenceClientHttpRequestError { |
|
|
constructor(message, httpRequest, httpResponse) { |
|
|
super(message, httpRequest, httpResponse); |
|
|
this.name = "HubApiError"; |
|
|
} |
|
|
} |
|
|
exports.InferenceClientHubApiError = InferenceClientHubApiError; |
|
|
|
|
|
|
|
|
|
|
|
class InferenceClientProviderOutputError extends InferenceClientError { |
|
|
constructor(message) { |
|
|
super(message); |
|
|
this.name = "ProviderOutputError"; |
|
|
} |
|
|
} |
|
|
exports.InferenceClientProviderOutputError = InferenceClientProviderOutputError; |
|
|
|