fixed error display

This commit is contained in:
Annika Hannig 2023-05-15 14:09:52 +02:00
parent 0449e563d8
commit 17a9cc67f2
No known key found for this signature in database
GPG Key ID: 62E226E47DDCE58D
2 changed files with 8 additions and 6 deletions

View File

@ -73,7 +73,7 @@ const Error = ({error, onDismiss}) => {
{rs && <span> of <b>{rs.name}</b></span>} {rs && <span> of <b>{rs.name}</b></span>}
{errorStatus}. {errorStatus}.
</p> </p>
<p>If this problem persist, we suggest you <p>If this problem persists, we suggest you
try again later.</p> try again later.</p>
</div> </div>
); );

View File

@ -33,15 +33,17 @@ const Status = ({routeServerId}) => {
}); });
}, [routeServerId, handleError]); }, [routeServerId, handleError]);
if (error && error.code >= 100 && error.code < 200) { const errorInfo = error?.response?.data;
if (errorInfo && errorInfo.tag === "CONNECTION_REFUSED") {
return ( return (
<div className="routeserver-status"> <div className="routeserver-status">
<div className="api-error"> <div className="api-error">
unreachable route server unreachable
</div> </div>
</div> </div>
); );
} else if (error?.response?.data?.tag === "GENERIC_ERROR") { } else if (errorInfo && errorInfo.tag === "GENERIC_ERROR") {
return ( return (
<div className="routeserver-status"> <div className="routeserver-status">
<div className="api-error"> <div className="api-error">
@ -49,11 +51,11 @@ const Status = ({routeServerId}) => {
</div> </div>
</div> </div>
); );
} else if (error) { } else if (errorInfo) {
return ( return (
<div className="routeserver-status"> <div className="routeserver-status">
<div className="api-error"> <div className="api-error">
{error.response?.data?.tag} {errorInfo.tag}
</div> </div>
</div> </div>
); );