Skip to content

Commit

Permalink
Fixing #2731, and adjusting error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalrymple committed Mar 13, 2023
1 parent 657fce8 commit 489c655
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/core/src/resources/Jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ export interface JobKubernetesAgentsSchema extends Record<string, unknown> {
user: UserSchema;
}

export interface JobVariableAttributeOption extends Record<string, unknown> {
key: string;
value: string;
}

export class Jobs<C extends boolean = false> extends BaseResource<C> {
all<E extends boolean = false>(
projectId: string | number,
Expand Down Expand Up @@ -161,7 +166,7 @@ export class Jobs<C extends boolean = false> extends BaseResource<C> {
play<E extends boolean = false>(
projectId: string | number,
jobId: number,
options?: Sudo & ShowExpanded<E>,
options?: { jobVariablesAttributes: JobVariableAttributeOption[] } & Sudo & ShowExpanded<E>,
): Promise<GitlabAPIResponse<JobSchema, C, E, void>> {
return RequestHelper.post<JobSchema>()(
this,
Expand Down
2 changes: 1 addition & 1 deletion packages/rest/src/Requester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export async function defaultRequestHandler(endpoint: string, options: RequestOp
const contentType = resolved.headers.get('Content-Type');
let description = 'API Request Error';

if (contentType.includes('application/pdf')) {
if (contentType.includes('application/json')) {
const output = JSON.parse(content);
description = output.error || output.message;
} else {
Expand Down

0 comments on commit 489c655

Please sign in to comment.