mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 03:25:13 +00:00
LibURL/Pattern: Add a representation of a URL Pattern error
As the comment in this file explains the caller of LibURL APIs are meant to assume if they see any error, that it is a TypeError since that is all the spec throws at the moment. A custom error type exists here so that we can include more information in TypeError's which are thrown.
This commit is contained in:
parent
de89f5af6d
commit
873f7e4b3d
Notes:
github-actions[bot]
2025-03-04 21:53:05 +00:00
Author: https://github.com/shannonbooth Commit: https://github.com/LadybirdBrowser/ladybird/commit/873f7e4b3dc Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3739 Reviewed-by: https://github.com/trflynn89
1 changed files with 23 additions and 0 deletions
23
Libraries/LibURL/Pattern/PatternError.h
Normal file
23
Libraries/LibURL/Pattern/PatternError.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Shannon Booth <shannon@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Error.h>
|
||||
#include <AK/String.h>
|
||||
|
||||
namespace URL::Pattern {
|
||||
|
||||
// NOTE: All exceptions which are thrown by the URLPattern spec are TypeErrors which web-based callers are expected to assume.
|
||||
// If this ever does not become the case, this should change to also include the error type.
|
||||
struct ErrorInfo {
|
||||
String message;
|
||||
};
|
||||
|
||||
template<typename ValueT>
|
||||
using PatternErrorOr = AK::ErrorOr<ValueT, ErrorInfo>;
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue