Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
9f0ce4a1
Commit
9f0ce4a1
authored
Jan 27, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
404 error if address is not provided
parent
884d2f21
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
Sol2UmlDiagram.tsx
ui/sol2uml/Sol2UmlDiagram.tsx
+6
-1
No files found.
ui/sol2uml/Sol2UmlDiagram.tsx
View file @
9f0ce4a1
...
...
@@ -3,6 +3,7 @@ import React from 'react';
import
type
{
SmartContract
}
from
'
types/api/contract
'
;
import
type
{
ResourceError
}
from
'
lib/api/resources
'
;
import
useApiQuery
from
'
lib/api/useApiQuery
'
;
import
ContentLoader
from
'
ui/shared/ContentLoader
'
;
...
...
@@ -26,7 +27,7 @@ function composeSources(contract: SmartContract | undefined) {
}
const
Sol2UmlDiagram
=
({
addressHash
}:
Props
)
=>
{
const
contractQuery
=
useApiQuery
(
'
contract
'
,
{
const
contractQuery
=
useApiQuery
<
'
contract
'
,
ResourceError
>
(
'
contract
'
,
{
pathParams
:
{
id
:
addressHash
},
queryOptions
:
{
enabled
:
Boolean
(
addressHash
),
...
...
@@ -58,6 +59,10 @@ const Sol2UmlDiagram = ({ addressHash }: Props) => {
newWindow?.document.write(image.outerHTML);
}, [ imgUrl ]);
if (!addressHash) {
throw Error('Contract address is not provided', { cause: { status: 404 } as unknown as Error });
}
if (contractQuery.isError) {
throw Error('Contract fetch error', { cause: contractQuery.error as unknown as Error });
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment