Skip to content

Commit a65575b

Browse files
committed
Use ConfigureationError for exceptions
1 parent f6d19ed commit a65575b

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

lib/start-proxy.js

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/start-proxy.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/start-proxy.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { parseLanguage, Language } from "./languages";
22
import { Logger } from "./logging";
3+
import { ConfigurationError } from "./util";
34

45
export type Credential = {
56
type: string;
@@ -57,14 +58,14 @@ export function getCredentials(
5758
} catch {
5859
// Don't log the error since it might contain sensitive information.
5960
logger.error("Failed to parse the credentials data.");
60-
throw new Error("Invalid credentials format.");
61+
throw new ConfigurationError("Invalid credentials format.");
6162
}
6263

6364
const out: Credential[] = [];
6465
for (const e of parsed) {
6566
if (e.url === undefined && e.host === undefined) {
6667
// The proxy needs one of these to work. If both are defined, the url has the precedence.
67-
throw new Error("Invalid credentials - must specify host or url");
68+
throw new ConfigurationError("Invalid credentials - must specify host or url");
6869
}
6970

7071
// Filter credentials based on language if specified. `type` is the registry type.
@@ -85,7 +86,7 @@ export function getCredentials(
8586
!isPrintable(e.password) ||
8687
!isPrintable(e.token)
8788
) {
88-
throw new Error(
89+
throw new ConfigurationError(
8990
"Invalid credentials - fields must contain only printable characters",
9091
);
9192
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy