26 lines
549 B
Go
26 lines
549 B
Go
|
package service_internal
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
internal "git.itzana.me/strafesnet/maps-service/pkg/internal"
|
||
|
"git.itzana.me/strafesnet/maps-service/pkg/datastore"
|
||
|
"github.com/nats-io/nats.go"
|
||
|
)
|
||
|
|
||
|
type Service struct {
|
||
|
DB datastore.Datastore
|
||
|
Nats nats.JetStreamContext
|
||
|
}
|
||
|
|
||
|
// yay duplicate code
|
||
|
func (svc *Service) NewError(ctx context.Context, err error) *internal.ErrorStatusCode {
|
||
|
status := 500
|
||
|
return &internal.ErrorStatusCode{
|
||
|
StatusCode: status,
|
||
|
Response: internal.Error{
|
||
|
Code: int64(status),
|
||
|
Message: err.Error(),
|
||
|
},
|
||
|
}
|
||
|
}
|