Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
chore: throw on compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub-Vacek committed Jul 17, 2023
1 parent 6409c1a commit 58b19cd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/common/polling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ export async function pollUrl(

if (result.status === PollStatus.Success) {
ux.succeed(`Successfully finished operation`);
return result.result_url;

return result.result_url;
} else if (result.status === PollStatus.Failed) {
throw userError(
`Failed to ${getJobDescription(result.result_type)}: ${
Expand Down
25 changes: 13 additions & 12 deletions src/logic/new.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ProviderJson } from '@superfaceai/ast';
import { parseDocumentId } from '@superfaceai/parser';
import { parseDocumentId, parseProfile,Source } from '@superfaceai/parser';
import type { ServiceClient } from '@superfaceai/service-client';

import type { UserError } from '../common/error';
Expand Down Expand Up @@ -39,17 +39,18 @@ function assertProfileResponse(
);
}

// try {
// parseProfile(new Source(tmp.profile.source));
// } catch (e) {
// throw userError(
// `Unexpected response received - unable to parse profile source: ${JSON.stringify(
// e,
// null,
// 2
// )}`, 1
// );
// }
try {
parseProfile(new Source(tmp.profile.source));
} catch (e) {
throw userError(
`Unexpected response received - unable to parse profile source: ${JSON.stringify(
e,
null,
2
)}`,
1
);
}

// TODO: validate id format?
if (typeof tmp.id === 'string') {
Expand Down

0 comments on commit 58b19cd

Please sign in to comment.