Skip to content

Commit

Permalink
feat(cli,serverless): improve error pages (#559)
Browse files Browse the repository at this point in the history
  • Loading branch information
QuiiBz authored Feb 3, 2023
1 parent fea698a commit 8e2eaa0
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 18 deletions.
6 changes: 6 additions & 0 deletions .changeset/warm-mails-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@lagon/cli': patch
'@lagon/serverless': patch
---

Improve error pages
14 changes: 10 additions & 4 deletions crates/runtime_utils/public/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,21 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://cdn.tailwindcss.com"></script>
<title>404 - Deployment Not Found</title>
<title>Deployment not found</title>
</head>

<body>
<section class="w-screen h-screen flex items-center justify-center flex-col">
<h1 class="font-semibold text-3xl text-gray-900 mb-1">Deployment Not Found</h1>
<span class="uppercase text-base text-blue-500 mb-6">404</span>
<p class="text-sm text-gray-800">This Deployment does not exist.</p>
<h1 class="font-semibold text-3xl text-gray-900 mb-1">Deployment not found</h1>
<span class="uppercase text-lg text-blue-500 mb-6">404</span>
<p class="text-base text-gray-800 text-center">This Deployment does not exist.</p>
</section>

<footer class="absolute bottom-4 left-[50%] transform -translate-x-[50%]">
<a href="https://lagon.app" target="_blank">
<img class="h-6" alt="Lagon logo" src="https://github.com/lagonapp/lagon/blob/main/assets/logo-black.png?raw=true" />
</a>
</footer>
</body>

</html>
19 changes: 13 additions & 6 deletions crates/runtime_utils/public/500.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,25 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://cdn.tailwindcss.com"></script>
<title>500 - Function Error</title>
<title>Function errored</title>
</head>

<body>
<section class="w-screen h-screen flex items-center justify-center flex-col">
<h1 class="font-semibold text-3xl text-gray-900 mb-1">Function Error</h1>
<span class="uppercase text-base text-blue-500 mb-6">500</span>
<p class="text-sm text-gray-800">
This Function errored. If you are the owner, <br />
check the "Logs" tab for more information.
<h1 class="font-semibold text-3xl text-gray-900 mb-1">Function errored</h1>
<span class="uppercase text-lg text-blue-500 mb-6">500</span>
<p class="text-base text-gray-800 text-center">
An error occurred while running this Function.
<br />
If you are the owner, check the logs.
</p>
</section>

<footer class="absolute bottom-4 left-[50%] transform -translate-x-[50%]">
<a href="https://lagon.app" target="_blank">
<img class="h-6" alt="Lagon logo" src="https://github.com/lagonapp/lagon/blob/main/assets/logo-black.png?raw=true" />
</a>
</footer>
</body>

</html>
18 changes: 14 additions & 4 deletions crates/runtime_utils/public/502.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,25 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://cdn.tailwindcss.com"></script>
<title>502 - Function Resources Reached</title>
<title>Function resources reached</title>
</head>

<body>
<section class="w-screen h-screen flex items-center justify-center flex-col">
<h1 class="font-semibold text-3xl text-gray-900 mb-1">Function Resources Reached</h1>
<span class="uppercase text-base text-blue-500 mb-6">502</span>
<p class="text-sm text-gray-800">Resources have been reached for this Function.</p>
<h1 class="font-semibold text-3xl text-gray-900 mb-1">Function resources reached</h1>
<span class="uppercase text-lg text-blue-500 mb-6">502</span>
<p class="text-base text-gray-800 text-center">
Resources have been reached for this
<br />
Function. Please try again.
</p>
</section>

<footer class="absolute bottom-4 left-[50%] transform -translate-x-[50%]">
<a href="https://lagon.app" target="_blank">
<img class="h-6" alt="Lagon logo" src="https://github.com/lagonapp/lagon/blob/main/assets/logo-black.png?raw=true" />
</a>
</footer>
</body>

</html>
2 changes: 0 additions & 2 deletions crates/serverless/src/deployments/pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ pub async fn clear_deployments_cache(
reason
);
}
} else {
warn!(hostname = hostname; "Could not clear deployment from cache");
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions crates/serverless/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ async fn handle_request(
"reason" => "No hostname",
"region" => REGION.clone(),
);
warn!(request = as_debug!(req), ip = ip; "No hostname found in request");

return Ok(Builder::new().status(404).body(PAGE_404.into())?);
}
Expand All @@ -109,7 +108,6 @@ async fn handle_request(
"hostname" => hostname.clone(),
"region" => REGION.clone(),
);
warn!(request = as_debug!(req), ip = ip, hostname = hostname; "No deployment found for hostname");

return Ok(HyperResponse::builder().status(404).body(PAGE_404.into())?);
}
Expand Down

0 comments on commit 8e2eaa0

Please sign in to comment.