ingredient/info: Add Fetcher concept

This commit is contained in:
Tom Wiesing 2022-10-19 10:50:40 +02:00
parent a6501b42c7
commit 52559e4d68
No known key found for this signature in database
22 changed files with 447 additions and 328 deletions

View file

@ -0,0 +1,36 @@
package phpserver
import "fmt"
// Common PHP Errors
var (
errPHPInit = "Unable to initialize"
errPHPMarshal = "Marshal failed"
errPHPInvalid = ServerError{Message: "Invalid code to execute"}
errPHPReceive = "Failed to receive response"
errPHPClosed = ServerError{Message: "Server closed"}
)
// PHPError represents an error during PHPServer logic
type ServerError struct {
Message string
Err error
}
func (err ServerError) Unwrap() error {
return err.Err
}
func (err ServerError) Error() string {
if err.Err == nil {
return fmt.Sprintf("PHPServer: %s", err.Message)
}
return fmt.Sprintf("PHPServer: %s: %s", err.Message, err.Err)
}
// Throwable represents an error during php code
type Throwable string
func (throwable Throwable) Error() string {
return string(throwable)
}