Comments (9)
BadCsrException
, BadNonceException
, ConnectException
, DnssecException
, MalformedRequestException
, InternalServerException
, TlsException
, UnauthorizedException
, UnknownHostException
.
I'm not happy with some of these names, do you have suggestions?
from acme.
Another alternative would be to return the type
in AcmeException::getCode
.
from acme.
I agree that all of those errors should be represented by 1 class (not 1 each) which then provides a method to further determine the underlying error
from acme.
I have improved the error messages, please review d3805a6.
from acme.
What about doing the type/detail handling inside the exception?
You can change the Exception constructor when extending, for example to typehint a Response object. You can then apply the same logic in your Eception.
You could also create a static factory for your AcmeException, to create on from a Response.
class AcmeException extends Exception {
public function __construct($message, Response $response = null, Exception $previous = null)
{
parent::__construct($message, 0, $previous);
if ($response) {
$info = json_decode($response->getBody(), true);
if ($info && isset($info['type'], $info['detail'])) {
$this->code = $info['type'];
$this->message .= ' ' . $info['detail'];
}
}
}
}
from acme.
Should the default error code be internal
, generic
, general
or unknown
?
from acme.
Don't know, could just leave it 0, the Exception default.
from acme.
Can I close this?
from acme.
Hmm, using a string as code might give unexpected results when stacking exceptions, see: zenire/da-letsencrypt#40
Testcase: https://3v4l.org/ObN47
from acme.
Related Issues (20)
- Invalid response: JWS has invalid anti-replay nonce HOT 1
- Fix failing tests HOT 3
- ECC Support HOT 1
- CSR creation with CN only HOT 5
- Support for Custom CSRs
- Support for Account Deletion HOT 1
- Invalid CSR config
- use dns01 Challenge HOT 8
- kelunik/acme is still using amphp/amp v1, will it be upgraded to use v2? HOT 5
- PHPDoc links don't work HOT 3
- Discrepancy between master and latest release HOT 15
- AcmeService::pollForCertificate does not work for the dns-01 HOT 1
- Certificate Renewal only for 5-6 days HOT 4
- Add verifier for CAA records HOT 2
- ACMEv2 support HOT 3
- Wildcard certificates HOT 3
- New release HOT 2
- Implement TLS ALPN support
- AcmeService Exception handling: Can't buffer() a payload more than once HOT 1
- Location header in FinalizeOrder response HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from acme.