Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dcellar-web-ui): semantic delegate create folder error message #394

Merged
merged 2 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions apps/dcellar-web-ui/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
{
"name": "dcellar-web-ui",
"entries": [
{
"version": "1.7.3",
"tag": "dcellar-web-ui_v1.7.3",
"date": "Fri, 06 Sep 2024 07:48:42 GMT",
"comments": {
"patch": [
{
"comment": "semantic delegate create folder error message"
}
]
}
},
{
"version": "1.7.2",
"tag": "dcellar-web-ui_v1.7.2",
Expand Down
9 changes: 8 additions & 1 deletion apps/dcellar-web-ui/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Change Log - dcellar-web-ui

This log was last generated on Wed, 21 Aug 2024 03:41:57 GMT and should not be manually modified.
This log was last generated on Fri, 06 Sep 2024 07:48:42 GMT and should not be manually modified.

## 1.7.3
Fri, 06 Sep 2024 07:48:42 GMT

### Patches

- semantic delegate create folder error message

## 1.7.2
Wed, 21 Aug 2024 03:41:57 GMT
Expand Down
2 changes: 1 addition & 1 deletion apps/dcellar-web-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dcellar-web-ui",
"version": "1.7.2",
"version": "1.7.3",
"private": false,
"scripts": {
"dev": "node ./scripts/dev.js -p 3200",
Expand Down
10 changes: 10 additions & 0 deletions apps/dcellar-web-ui/src/facade/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,13 @@ export const queryLockFeeFault = (e: any): ErrorResponse => {

return [null, E_UNKNOWN_ERROR];
};

export const semanticRPCError = (err: string): string => {
if (!err) return E_UNKNOWN_ERROR;
const errorList = [
{ key: 'is frozen', message: 'Your account is frozen. Please deposit to reactivate it.' },
];
const foundError = errorList.find(({ key }) => err.includes(key));

return foundError?.message ?? err;
};
5 changes: 3 additions & 2 deletions apps/dcellar-web-ui/src/facade/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
commonFault,
createTxFault,
queryLockFeeFault,
semanticRPCError,
simulateFault,
} from '@/facade/error';
import { getClient } from '@/facade/index';
Expand Down Expand Up @@ -720,8 +721,8 @@ export const delegateCreateFolder = async (
.delegateCreateFolder(request, auth)
.then(resolve, commonFault);

if (!result || error) return [null, error];
if (result.code !== 0 || !result.body) return [null, result.message ?? ''];
if (!result || error) return [null, semanticRPCError(error)];
if (result.code !== 0 || !result.body) return [null, semanticRPCError(result.message ?? '')];

return [result.body, null];
};
Loading