Skip to content

Commit

Permalink
Merge pull request #4577 from kishanprmr/apitable-error
Browse files Browse the repository at this point in the history
fix(apitable): fail step on API error
  • Loading branch information
abuaboud committed Apr 29, 2024
2 parents 34395f0 + 90f599d commit 3602a79
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/pieces/community/apitable/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "@activepieces/piece-apitable",
"version": "0.0.12"
"version": "0.0.13"
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const createRecordAction = createAction({
const client = makeClient(
context.auth as PiecePropValueSchema<typeof APITableAuth>
);
return await client.createRecord(datasheetId as string, {
const response: any = await client.createRecord(datasheetId as string, {
records: [
{
fields: {
Expand All @@ -49,5 +49,10 @@ export const createRecordAction = createAction({
},
],
});

if (!response.success) {
throw new Error(JSON.stringify(response, undefined, 2));
}
return response;
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const findRecordAction = createAction({
const client = makeClient(
context.auth as PiecePropValueSchema<typeof APITableAuth>
);
return await client.listRecords(
const response: any = await client.listRecords(
datasheetId as string,
prepareQuery({
pageSize: pageSize,
Expand All @@ -71,5 +71,10 @@ export const findRecordAction = createAction({
filterByFormula: filter,
})
);

if (!response.success) {
throw new Error(JSON.stringify(response, undefined, 2));
}
return response;
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const updateRecordAction = createAction({
context.auth as PiecePropValueSchema<typeof APITableAuth>
);

return await client.updateRecord(datasheetId as string, {
const response: any = await client.updateRecord(datasheetId as string, {
records: [
{
recordId: recordId,
Expand All @@ -58,5 +58,10 @@ export const updateRecordAction = createAction({
},
],
});

if (!response.success) {
throw new Error(JSON.stringify(response, undefined, 2));
}
return response;
},
});

0 comments on commit 3602a79

Please sign in to comment.