forked from Jigsaw-Code/outline-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create an endpoint to change the default port for new access keys (Ji…
…gsaw-Code#461) * Add an endpoint to set a new port for access keys * post commit formatting * Document the new api * Remove enum in errors * Respond to review comments * Respond to review comments * Rename to ShadowboxError and add copywright header * Move to errors.ts * Respond to coments in access_key.ts * Move to errors.ts * More renames * post commit formatting * More review responses * Correctly convert invalid port number to string * More renaming * post commit formatting * Respond to review comments * Fix issue using parseInt * Change endpoint URL * formatting * Respond to more review comments * Respond to comments, add to integration test * post commit formatting * Move invalidPortArgument into a local * formatting * More review * more review * formatting * disambiguate errors using restify types * formatting * fix the integration test
- Loading branch information
Jonathan Cohen
authored
Aug 15, 2019
1 parent
36d467f
commit 16f6c15
Showing
11 changed files
with
486 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2019 The Outline Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
class ShadowboxError extends Error { | ||
constructor(message: string) { | ||
super(message); | ||
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget | ||
Object.setPrototypeOf(this, new.target.prototype); | ||
} | ||
} | ||
|
||
export class InvalidPortNumber extends ShadowboxError { | ||
// Since this is the error when a non-numeric value is passed to `port`, it takes type `string`. | ||
constructor(public port: string) { | ||
super(port); | ||
} | ||
} | ||
|
||
export class PortUnavailable extends ShadowboxError { | ||
constructor(public port: number) { | ||
super(port.toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.