@@ -44,22 +44,13 @@ export class DataConnectError extends FirebaseError {
44
44
readonly name : string = 'DataConnectError' ;
45
45
46
46
/** @hideconstructor */
47
- constructor (
48
- /**
49
- * The backend error code associated with this error.
50
- */
51
- readonly code : DataConnectErrorCode ,
52
- /**
53
- * A custom error description.
54
- */
55
- message : string
56
- ) {
47
+ constructor ( code : Code , message : string ) {
57
48
super ( code , message ) ;
58
49
59
50
// Ensure the instanceof operator works as expected on subclasses of Error.
60
51
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#custom_error_types
61
52
// and https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
62
- Object . setPrototypeOf ( this , new . target . prototype ) ;
53
+ Object . setPrototypeOf ( this , DataConnectError . prototype ) ;
63
54
}
64
55
65
56
/** @internal */
@@ -78,13 +69,8 @@ export class DataConnectOperationError extends DataConnectError {
78
69
79
70
/** @hideconstructor */
80
71
constructor ( message : string , response : DataConnectOperationResponse ) {
81
- super ( 'partial-error' , message ) ;
72
+ super ( Code . PARTIAL_ERROR , message ) ;
82
73
this . response = response ;
83
-
84
- // Ensure the instanceof operator works as expected on subclasses of Error.
85
- // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#custom_error_types
86
- // and https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
87
- Object . setPrototypeOf ( this , new . target . prototype ) ;
88
74
}
89
75
}
90
76
0 commit comments