mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:37:44 +00:00
LibPDF: Add Errors class that accumulate multiple errors
This will be used to perform a best-effort rendering, where an error in rendering won't abort the whole rendering operation, but instead will be stored for later reference while rendering continues.
This commit is contained in:
parent
d9718064d1
commit
96fb4b20f1
1 changed files with 27 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/DeprecatedString.h>
|
#include <AK/DeprecatedString.h>
|
||||||
|
#include <AK/Vector.h>
|
||||||
|
|
||||||
namespace PDF {
|
namespace PDF {
|
||||||
|
|
||||||
|
@ -52,7 +53,33 @@ private:
|
||||||
DeprecatedString m_message;
|
DeprecatedString m_message;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Errors {
|
||||||
|
|
||||||
|
public:
|
||||||
|
Errors() = default;
|
||||||
|
Errors(Error&& error)
|
||||||
|
{
|
||||||
|
m_errors.empend(move(error));
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector<Error> const& errors() const
|
||||||
|
{
|
||||||
|
return m_errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
void add_error(Error&& error)
|
||||||
|
{
|
||||||
|
m_errors.empend(move(error));
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Vector<Error> m_errors;
|
||||||
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
using PDFErrorOr = ErrorOr<T, Error>;
|
using PDFErrorOr = ErrorOr<T, Error>;
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
using PDFErrorsOr = ErrorOr<T, Errors>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue