mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-26 17:08:33 +01:00
fix errors
This commit is contained in:
parent
eb83569f2f
commit
83e91b70ff
@ -36,7 +36,7 @@ export class CreateCommand {
|
||||
await this.cipherService.saveWithServer(cipher);
|
||||
return Response.success();
|
||||
} catch (e) {
|
||||
return Response.error(e.toString());
|
||||
return Response.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ export class CreateCommand {
|
||||
await this.folderService.saveWithServer(folder);
|
||||
return Response.success();
|
||||
} catch (e) {
|
||||
return Response.error(e.toString());
|
||||
return Response.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ export class DeleteCommand {
|
||||
await this.cipherService.deleteWithServer(id);
|
||||
return Response.success();
|
||||
} catch (e) {
|
||||
return Response.error(e.toString());
|
||||
return Response.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ export class DeleteCommand {
|
||||
await this.folderService.deleteWithServer(id);
|
||||
return Response.success();
|
||||
} catch (e) {
|
||||
return Response.error(e.toString());
|
||||
return Response.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ export class LoginCommand {
|
||||
// TODO: 2FA
|
||||
return Response.success();
|
||||
} catch (e) {
|
||||
return Response.success(e.toString());
|
||||
return Response.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ export class SyncCommand {
|
||||
const result = await this.syncService.fullSync(cmd.force || false);
|
||||
return Response.success();
|
||||
} catch (e) {
|
||||
return Response.success(e.toString());
|
||||
return Response.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,14 @@
|
||||
import { BaseResponse } from './response/baseResponse';
|
||||
|
||||
export class Response {
|
||||
static error(message: string): Response {
|
||||
static error(error: any): Response {
|
||||
const res = new Response();
|
||||
res.success = false;
|
||||
res.message = message;
|
||||
if (typeof (error) === 'string') {
|
||||
res.message = error;
|
||||
} else {
|
||||
res.message = error.message != null ? error.message : error.toString();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,7 @@ const plugins = [
|
||||
banner: '#!/usr/bin/env node',
|
||||
raw: true
|
||||
}),
|
||||
new webpack.IgnorePlugin(/^encoding$/, /node-fetch/),
|
||||
];
|
||||
|
||||
const config = {
|
||||
|
Loading…
Reference in New Issue
Block a user