Skip to content

Commit

Permalink
fix: log a more helpful 404
Browse files Browse the repository at this point in the history
  • Loading branch information
wkillerud committed Jan 18, 2024
1 parent b5ed697 commit 763ffda
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions classes/alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ module.exports = class Alias {
this.log.debug(
`Requesting creation of ${this.type} alias "v${this.alias}" for ${this.name} v${this.version} on ${this.server}`,
);

const pathname = join(this.type, this.name, `v${this.alias}`);
try {
const { message } = await request({
host: this.server,
method: 'PUT',
pathname: join(this.type, this.name, `v${this.alias}`),
pathname,
data: { version: this.version },
token: this.token,
});
Expand All @@ -73,7 +75,7 @@ module.exports = class Alias {
const { message: msg } = await request({
host: this.server,
method: 'POST',
pathname: join(this.type, this.name, `v${this.alias}`),
pathname,
data: { version: this.version },
token: this.token,
});
Expand All @@ -100,7 +102,7 @@ module.exports = class Alias {
throw new Error('Client unauthorized with server');
case 404:
throw new Error(
'The server was unable to locate the required resource',
`The server was unable to locate ${pathname}. Ensure you have the correct package type (eik package-alias vs eik npm-alias), name and that the version exists on the server.`,
);
case 409:
throw new Error(
Expand Down

0 comments on commit 763ffda

Please sign in to comment.