unstructured-client
Version:
<h3 align="center"> <img src="https://raw.githubusercontent.com/Unstructured-IO/unstructured/main/img/unstructured_logo.png" height="200" > </h3>
43 lines (38 loc) • 928 B
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
export class SDKError extends Error {
/**
* HTTP status code
*/
public readonly statusCode: number;
/**
* HTTP content type
*/
public readonly contentType: string;
/**
* HTTP body
*/
public readonly body: string;
/**
* Raw response
*/
public readonly rawResponse: Response;
constructor(
message: string,
rawResponse: Response,
body: string = "",
) {
const statusCode = rawResponse.status;
const contentType = rawResponse.headers.get("content-type") || "";
const bodyString = body.length > 0 ? `\n${body}` : "";
super(
`${message}: Status ${statusCode} Content-Type ${contentType} Body ${bodyString}`,
);
this.body = body;
this.rawResponse = rawResponse;
this.statusCode = statusCode;
this.contentType = contentType;
this.name = "SDKError";
}
}