Skip to content

Commit

Permalink
Merge pull request #45 from filmineio/fix/add-exception-on-verify-fail
Browse files Browse the repository at this point in the history
Add exception on contract verify fail
  • Loading branch information
pyropy authored Mar 7, 2023
2 parents 7865128 + 81b77d2 commit bca3940
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/handlers/contracts/verify/handler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import fs from 'fs';
import { ContractVerificationStatus } from "@/enums/ContractVerificationStatus";
import { createContractMetadata } from "@/handlers/contracts/verify/utils/createContractMetadata";
import { downloadFile } from "@/handlers/contracts/verify/utils/downloadFile";
Expand All @@ -11,6 +10,7 @@ import { uploadMetadata } from "@/handlers/contracts/verify/utils/uploadMetadata
import { verify } from "@/handlers/contracts/verify/utils/verify";
import { v4 } from "@lukeed/uuid";
import { Request, Response } from "express";
import fs from "fs";

import { OperationStatus } from "@/types/ApiResponse";

Expand Down Expand Up @@ -75,6 +75,13 @@ export const handle = async (ctx: ApiCtx, req: Request, res: Response) => {
await createContractMetadata(ctx, meta, contract, verifyReq, user);
}

if (verificationResult.errors.length > 0) {
return res.status(400).json({
...verificationResult,
exception: "CONTRACT_VERIFICATION_FAILED",
});
}

return res.json(verificationResult);
} catch (e) {
return res.status(400).json({ exception: e });
Expand Down

1 comment on commit bca3940

@vercel
Copy link

@vercel vercel bot commented on bca3940 Mar 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.