1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-09-11 22:30:47 +03:00
Files
authentication-service/templates/pages/error.html
reivilibre 49e8fe57f4 Improve errors when MAS contacts the Synapse homeserver (#2794)
* Add some drive-by docstrings

* Change text rendering of catch_http_codes::HttpError

Using `#[source]` is unnatural here because it makes it look like
two distinct errors (one being a cause of the other),
when in reality it is just one error, with 2 parts.

Using `Display` formatting for that leads to a more natural error.

* Add constraints to `catch_http_code{,s}` methods

Not strictly required, but does two things:

- documents what kind of function is expected
- provides a small extra amount of type enforcement at the call site,
  rather than later on when you find the result doesn't implement Service

* Add a `catch_http_errors` shorthand

Nothing major, just a quality of life improvement so you don't have to
repetitively write out what a HTTP error is

* Unexpected error page: remove leading whitespace from preformatted 'details' section

The extra whitespace was probably unintentional and makes the error harder to read,
particularly when it wraps onto a new line unnecessarily

* Capture and log Matrix errors received from Synapse

* Drive-by clippy fix: use clamp instead of min().max()

* Convert `err(Display)` to `err(Debug)` for `anyhow::Error`s in matrix-synapse support module
2024-06-07 11:14:04 +00:00

51 lines
1.4 KiB
HTML

{#
Copyright 2021 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
#}
{# Sometimes we don't have the language set, so we default to english #}
{% set lang = lang or "en" %}
{% extends "base.html" %}
{% block content %}
<main class="flex flex-col gap-6">
<header class="page-heading">
<div class="icon invalid">
{{ icon.error() }}
</div>
<div class="header">
<h1 class="title">{{ _("error.unexpected") }}</h1>
{% if code %}
<p class="text font-semibold font-mono">
{{ code }}
</p>
{% endif %}
{% if description %}
<p class="text">
{{ description }}
</p>
{% endif %}
</div>
</header>
{% if details %}
<hr />
{# caution: do not introduce whitespace between <pre> and <code> #}
<pre><code class="font-mono whitespace-pre-wrap break-all">{{ details }}</code></pre>
{% endif %}
</main>
{% endblock %}