Skip to content

Commit

Permalink
Better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mdima committed Apr 27, 2024
1 parent 8125815 commit 29010d1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ Based on the original repository: https://github.com/bencorn/traceroute

### Running in Docker
You can use the following image to run Visual Trace Route locally:
michele73/traceroute:1.1.0
michele73/traceroute:1.1.1

Example:
docker run -d -p 8081:80 --name=traceroute --restart=always -v traecroute_logs:/app/logs michele73/traceroute:1.1.0
docker run -d -p 8081:80 --name=traceroute --restart=always -v traecroute_logs:/app/logs michele73/traceroute:1.1.1

### Live Demo
You can view a live demo of the Trace Route application here: https://traceroute.di-maria.it/
2 changes: 1 addition & 1 deletion TraceRoute/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<body ng-app="traceRouteApp" ng-controller="traceRouteController as vm">
<nav class="navbar navbar-dark bg-dark navbar-fixed-top">
<a class="navbar-brand ms-3" href="/">TraceRoute</a>
<div class="spinner-border text-light ms-3" role="status" ng-show="vm.isTracing">
<div class="spinner-border text-light ms-2" role="status" ng-show="vm.isTracing">
<span class="visually-hidden">Loading...</span>
</div>
<div class="justify-content-end">
Expand Down
21 changes: 17 additions & 4 deletions TraceRoute/wwwroot/js/traceRouteController.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,25 @@
});

vm.TraceRoute = function () {
if (!vm.Hostname)
{
vm.ErrorDescription = "Please specify an IP or host to trace";
let toastError = bootstrap.Toast.getOrCreateInstance($("#ToastError"));
toastError.show();
return;
}
vm.isTracing = true;
clearMarkersAndPaths();
clearMarkersAndPaths();
$http.get("api/trace/" + vm.Hostname)
.then(
function successFunction(response) {
vm.isTracing = false;
theResponse = angular.fromJson(response);
if (theResponse.data.errorDescription)
{
//alert("error")
vm.ErrorDescription = theResponse.data.errorDescription;
let toastError = bootstrap.Toast.getOrCreateInstance($("#ToastError"));
toastError.show();
toastError.show();
return;
}
vm.HostList = theResponse.data.hops;
Expand All @@ -47,7 +53,14 @@
);
}
}
);
)
.catch((err) => {
vm.isTracing = false;
vm.ErrorDescription = "Could not calculate the route";
let toastError = bootstrap.Toast.getOrCreateInstance($("#ToastError"));
toastError.show();
console.error('An error occurred:', err);
});
};

vm.ShowAbout = function () {
Expand Down

0 comments on commit 29010d1

Please sign in to comment.