Skip to content

Commit

Permalink
fix(dcellar-web-ui): semantic delegate create folder error message (#394
Browse files Browse the repository at this point in the history
)

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

* docs(dcellar-web-ui): update changelog
  • Loading branch information
devinxl authored Sep 6, 2024
1 parent 393b835 commit 056ea05
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 4 deletions.
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];
};

0 comments on commit 056ea05

Please sign in to comment.