Skip to content

Commit

Permalink
fix: rename error type enum (#66)
Browse files Browse the repository at this point in the history
Co-authored-by: Bryce Tham <[email protected]>
  • Loading branch information
brycetham and Bryce Tham authored Dec 12, 2023
1 parent e8ae2bc commit cc3473b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/device/device-management.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WebrtcCoreError, WebrtcCoreErrorTypes } from '../errors';
import { WebrtcCoreError, WebrtcCoreErrorType } from '../errors';
import * as media from '../media';
import { LocalCameraStream } from '../media/local-camera-stream';
import { LocalDisplayStream } from '../media/local-display-stream';
Expand Down Expand Up @@ -45,7 +45,7 @@ export async function createCameraStream<T extends LocalCameraStream>(
stream = await media.getUserMedia({ video: { ...constraints } });
} catch (error) {
throw new WebrtcCoreError(
WebrtcCoreErrorTypes.CREATE_STREAM_FAILED,
WebrtcCoreErrorType.CREATE_STREAM_FAILED,
`Failed to create camera stream: ${error}`
);
}
Expand All @@ -68,7 +68,7 @@ export async function createMicrophoneStream<T extends LocalMicrophoneStream>(
stream = await media.getUserMedia({ audio: { ...constraints } });
} catch (error) {
throw new WebrtcCoreError(
WebrtcCoreErrorTypes.CREATE_STREAM_FAILED,
WebrtcCoreErrorType.CREATE_STREAM_FAILED,
`Failed to create microphone stream: ${error}`
);
}
Expand Down Expand Up @@ -101,7 +101,7 @@ export async function createCameraAndMicrophoneStreams<
});
} catch (error) {
throw new WebrtcCoreError(
WebrtcCoreErrorTypes.CREATE_STREAM_FAILED,
WebrtcCoreErrorType.CREATE_STREAM_FAILED,
`Failed to create camera and microphone streams: ${error}`
);
}
Expand Down Expand Up @@ -130,7 +130,7 @@ export async function createDisplayStream<T extends LocalDisplayStream>(
stream = await media.getDisplayMedia({ video: true });
} catch (error) {
throw new WebrtcCoreError(
WebrtcCoreErrorTypes.CREATE_STREAM_FAILED,
WebrtcCoreErrorType.CREATE_STREAM_FAILED,
`Failed to create display stream: ${error}`
);
}
Expand Down Expand Up @@ -164,7 +164,7 @@ export async function createDisplayStreamWithAudio<
stream = await media.getDisplayMedia({ video: true, audio: true });
} catch (error) {
throw new WebrtcCoreError(
WebrtcCoreErrorTypes.CREATE_STREAM_FAILED,
WebrtcCoreErrorType.CREATE_STREAM_FAILED,
`Failed to create display and system audio streams: ${error}`
);
}
Expand Down Expand Up @@ -198,7 +198,7 @@ export async function getDevices(deviceKind?: media.DeviceKind): Promise<MediaDe
);
} catch (error) {
throw new WebrtcCoreError(
WebrtcCoreErrorTypes.DEVICE_PERMISSION_DENIED,
WebrtcCoreErrorType.DEVICE_PERMISSION_DENIED,
'Failed to ensure device permissions'
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/errors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum WebrtcCoreErrorTypes {
export enum WebrtcCoreErrorType {
DEVICE_PERMISSION_DENIED = 'DEVICE_PERMISSION_DENIED',
CREATE_STREAM_FAILED = 'CREATE_STREAM_FAILED',
}
Expand All @@ -17,7 +17,7 @@ export class WebrtcCoreError {
* @param type - Error type.
* @param message - Error message.
*/
constructor(type: WebrtcCoreErrorTypes, message = '') {
constructor(type: WebrtcCoreErrorType, message = '') {
this.type = type;
this.message = message;
}
Expand Down

0 comments on commit cc3473b

Please sign in to comment.