1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-02 08:40:08 +01:00

add ids to data when erroring with multipleResults

This commit is contained in:
Kyle Spearrin 2019-10-21 13:51:48 -04:00
parent b3d1e9d233
commit 8ab36db5c6
2 changed files with 4 additions and 3 deletions

View File

@ -69,7 +69,7 @@ export abstract class BaseProgram {
}
}
protected getMessage(response: Response) {
protected getMessage(response: Response): string {
const message = (response.data as MessageResponse);
if (process.env.BW_RAW === 'true') {
return message.raw;

View File

@ -1,7 +1,7 @@
import { BaseResponse } from './response/baseResponse';
export class Response {
static error(error: any): Response {
static error(error: any, data?: any): Response {
const res = new Response();
res.success = false;
if (typeof (error) === 'string') {
@ -9,6 +9,7 @@ export class Response {
} else {
res.message = error.message != null ? error.message : error.toString();
}
res.data = data;
return res;
}
@ -26,7 +27,7 @@ export class Response {
ids.forEach((id) => {
msg += '\n' + id;
});
return Response.error(msg);
return Response.error(msg, ids);
}
static success(data?: BaseResponse): Response {