Skip to content

Commit

Permalink
refactor: drop dependency on createErrorClass (#325)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored Jun 7, 2019
1 parent 9f13086 commit aedebee
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
1 change: 0 additions & 1 deletion packages/google-cloud-compute/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"@google-cloud/promisify": "^1.0.0",
"arrify": "^2.0.0",
"async": "^3.0.0",
"create-error-class": "^3.0.2",
"extend": "^3.0.1",
"gce-images": "^2.0.0",
"is": "^3.2.1",
Expand Down
4 changes: 1 addition & 3 deletions packages/google-cloud-compute/src/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,7 @@ class Snapshot extends common.ServiceObject {
const compute = isDisk ? scope.zone.compute : scope;
const config = {
parent: scope,
baseUrl: `https://${
compute.apiEndpoint
}/compute/v1/projects/{{projectId}}/global/snapshots`,
baseUrl: `https://${compute.apiEndpoint}/compute/v1/projects/{{projectId}}/global/snapshots`,
/**
* @name Snapshot#id
* @type {string}
Expand Down
15 changes: 12 additions & 3 deletions packages/google-cloud-compute/src/vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
'use strict';

const common = require('@google-cloud/common');
const createErrorClass = require('create-error-class');
const format = require('string-format-obj');
const is = require('is');
const {promisifyAll} = require('@google-cloud/promisify');
Expand All @@ -33,7 +32,12 @@ const Disk = require('./disk.js');
* @param {string} message - Custom error message.
* @returns {Error}
*/
const DetachDiskError = createErrorClass('DetachDiskError');
class DetachDiskError extends Error {
constructor(message) {
super(message);
this.name = 'DetachDiskError';
}
}

/**
* Custom error type for when `waitFor()` does not return a status in a timely
Expand All @@ -44,7 +48,12 @@ const DetachDiskError = createErrorClass('DetachDiskError');
* @param {string} message - Custom error message.
* @returns {Error}
*/
const WaitForTimeoutError = createErrorClass('WaitForTimeoutError');
class WaitForTimeoutError extends Error {
constructor(message) {
super(message);
this.name = 'WaitForTimeoutError';
}
}

/**
* The statuses that a VM can be in.
Expand Down

0 comments on commit aedebee

Please sign in to comment.