mirror of
https://github.com/SigNoz/signoz.git
synced 2026-02-21 16:13:37 +00:00
## 📄 Summary
- Instead of relying on JWT for session management, we are adding another token system: opaque. This gives the benefits of expiration and revocation.
- We are now ensuring that emails are regex checked throughout the backend.
- Support has been added for OIDC protocol
61 lines
1.2 KiB
Go
61 lines
1.2 KiB
Go
package errors
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/url"
|
|
)
|
|
|
|
type JSON struct {
|
|
Code string `json:"code"`
|
|
Message string `json:"message"`
|
|
Url string `json:"url,omitempty"`
|
|
Errors []responseerroradditional `json:"errors,omitempty"`
|
|
}
|
|
|
|
type responseerroradditional struct {
|
|
Message string `json:"message"`
|
|
}
|
|
|
|
func AsJSON(cause error) *JSON {
|
|
// See if this is an instance of the base error or not
|
|
_, c, m, _, u, a := Unwrapb(cause)
|
|
|
|
rea := make([]responseerroradditional, len(a))
|
|
for k, v := range a {
|
|
rea[k] = responseerroradditional{v}
|
|
}
|
|
|
|
return &JSON{
|
|
Code: c.String(),
|
|
Message: m,
|
|
Url: u,
|
|
Errors: rea,
|
|
}
|
|
}
|
|
|
|
func AsURLValues(cause error) url.Values {
|
|
// See if this is an instance of the base error or not
|
|
_, c, m, _, u, a := Unwrapb(cause)
|
|
|
|
rea := make([]responseerroradditional, len(a))
|
|
for k, v := range a {
|
|
rea[k] = responseerroradditional{v}
|
|
}
|
|
|
|
errors, err := json.Marshal(rea)
|
|
if err != nil {
|
|
return url.Values{
|
|
"code": {c.String()},
|
|
"message": {m},
|
|
"url": {u},
|
|
}
|
|
}
|
|
|
|
return url.Values{
|
|
"code": {c.String()},
|
|
"message": {m},
|
|
"url": {u},
|
|
"errors": {string(errors)},
|
|
}
|
|
}
|