From b08047ba485f86038f33175162943c0a9878ab1a Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Fri, 19 Sep 2025 17:03:47 +0200 Subject: add separate matrix specification package --- matrix-specification/Errors/Error.php | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 matrix-specification/Errors/Error.php (limited to 'matrix-specification/Errors/Error.php') diff --git a/matrix-specification/Errors/Error.php b/matrix-specification/Errors/Error.php new file mode 100644 index 0000000..2adc642 --- /dev/null +++ b/matrix-specification/Errors/Error.php @@ -0,0 +1,41 @@ +errorCode; + } + + public function getHttpCode(): int + { + return $this->getCode(); + } + + /** + * @return array + */ + abstract public function getAdditionalData(): array; + + public function jsonSerialize(): array + { + return [ + "errcode" => $this->getErrorCode(), + "error" => $this->getMessage(), + ...$this->getAdditionalData(), + ]; + } +} -- cgit v1.2.3