ingredient/info: Add Fetcher concept
This commit is contained in:
parent
a6501b42c7
commit
52559e4d68
22 changed files with 447 additions and 328 deletions
36
internal/wisski/ingredient/php/phpserver/errors.go
Normal file
36
internal/wisski/ingredient/php/phpserver/errors.go
Normal 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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue