Upgrade laconic-sdk package for showing error with reason in console (#165)

* Upgrade laconic sdk version

* Update toast message for add project

* Log error messages

* Update bond id in readme

---------

Co-authored-by: neeraj <neeraj.rtly@gmail.com>
This commit is contained in:
2024-04-03 20:26:34 +05:30
committed by GitHub
co-authored by neeraj
parent 78f04c3669
commit 351db16336
6 changed files with 39 additions and 22 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
"version": "1.0.0",
"main": "index.js",
"dependencies": {
"@cerc-io/laconic-sdk": "^0.1.14",
"@cerc-io/laconic-sdk": "^0.1.16",
"@graphql-tools/schema": "^10.0.2",
"@graphql-tools/utils": "^10.0.12",
"@octokit/oauth-app": "^6.1.0",
+4 -4
View File
@@ -30,8 +30,8 @@
## Troubleshoot
- Check deployment status [here](https://console.laconic.com/deployer).
- Check records [here](https://console.laconic.com/#/registry).
- Check deployment status in [web-app deployer](https://console.laconic.com/deployer).
- Check records in [registry console app](https://console.laconic.com/#/registry).
- If deployment fails due to low bond balance
- Check balances
@@ -40,9 +40,9 @@
yarn laconic cns account get
# Bond balance
yarn laconic cns bond get --id 8fcf44b2f326b4b63ac57547777f1c78b7d494e5966e508f09001af53cb440ac
yarn laconic cns bond get --id 99c0e9aec0ac1b8187faa579be3b54f93fafb6060ac1fd29170b860df605be32
```
- Command to refill bond
```bash
yarn laconic cns bond refill --id 8fcf44b2f326b4b63ac57547777f1c78b7d494e5966e508f09001af53cb440ac --type aphoton --quantity 10000000
yarn laconic cns bond refill --id 99c0e9aec0ac1b8187faa579be3b54f93fafb6060ac1fd29170b860df605be32 --type aphoton --quantity 10000000
```
+1 -1
View File
@@ -13,7 +13,7 @@ PACKAGE_VERSION=$(jq -r '.version' ../frontend/package.json)
CURRENT_DATE_TIME=$(date -u)
CONFIG_FILE=config.yml
REGISTRY_BOND_ID="8fcf44b2f326b4b63ac57547777f1c78b7d494e5966e508f09001af53cb440ac"
REGISTRY_BOND_ID="99c0e9aec0ac1b8187faa579be3b54f93fafb6060ac1fd29170b860df605be32"
# Reference: https://git.vdb.to/cerc-io/test-progressive-web-app/src/branch/main/scripts
@@ -58,7 +58,7 @@ export const ProjectRepoCard: React.FC<ProjectRepoCardProps> = ({
});
}
} catch (error) {
console.error(error);
console.error((error as Error).message);
toast({
id: 'failed-to-create-project',
title: 'Failed to create project',
@@ -1,9 +1,9 @@
import React, { useCallback, useEffect, useState } from 'react';
import { useForm, SubmitHandler, Controller } from 'react-hook-form';
import { useNavigate, useOutletContext, useParams } from 'react-router-dom';
import toast from 'react-hot-toast';
import assert from 'assert';
import { useMediaQuery } from 'usehooks-ts';
import { RequestError } from 'octokit';
import { useOctokit } from '../../../../../context/OctokitContext';
import { useGQLClient } from '../../../../../context/GQLClientContext';
@@ -14,6 +14,9 @@ import { Select, SelectOption } from 'components/shared/Select';
import { ArrowRightCircleFilledIcon } from 'components/shared/CustomIcon';
import { Checkbox } from 'components/shared/Checkbox';
import { Button } from 'components/shared/Button';
import { useToast } from 'components/shared/Toast';
const REPO_EXIST_ERROR = 'Could not clone: Name already exists on this account';
type SubmitRepoValues = {
framework: string;
@@ -28,6 +31,7 @@ const CreateRepo = () => {
const client = useGQLClient();
const { orgSlug } = useParams();
const { toast, dismiss } = useToast();
const isTabletView = useMediaQuery('(min-width: 720px)'); // md:
const buttonSize = isTabletView ? { size: 'lg' as const } : {};
@@ -68,18 +72,31 @@ const CreateRepo = () => {
template: 'webapp',
});
if (Boolean(addProject)) {
setIsLoading(true);
navigate(
`deploy?projectId=${addProject.id}&templateId=${template.id}`,
);
} else {
setIsLoading(false);
}
navigate(`deploy?projectId=${addProject.id}&templateId=${template.id}`);
} catch (err) {
console.error(err);
setIsLoading(false);
toast.error('Error deploying project');
if (
err instanceof RequestError &&
err.message.includes(REPO_EXIST_ERROR)
) {
toast({
id: 'repo-exist-error',
title: 'Could not create: repository already exists',
variant: 'error',
onDismiss: dismiss,
});
return;
}
console.error((err as Error).message);
toast({
id: 'failed-to-create-project',
title: 'Failed to create project',
variant: 'error',
onDismiss: dismiss,
});
}
},
[octokit],