Skip to content

Commit

Permalink
[ML] Add errors.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
peteharverson committed Mar 16, 2020
1 parent d3df262 commit 995f03a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions x-pack/plugins/ml/common/types/errors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export interface ErrorResponse {
body: {
statusCode: number;
error: string;
message: string;
};
name: string;
}

export function isErrorResponse(arg: any): arg is ErrorResponse {
return arg?.body?.error !== undefined && arg?.body?.message !== undefined;
}

0 comments on commit 995f03a

Please sign in to comment.