File size: 1,472 Bytes
b0f0dc1
 
212dffe
 
 
602f6ba
b0f0dc1
602f6ba
 
 
 
 
 
 
 
 
 
 
 
2bf583e
7c4520d
 
decc167
7c4520d
 
 
 
602f6ba
 
 
2bf583e
 
 
602f6ba
b0f0dc1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package models

import (
	"api.qobiltu.id/pkg/validation"
)

type Exception struct {
	Unauthorized          bool `json:"unauthorized,omitempty"`
	BadRequest            bool `json:"bad_request,omitempty"`
	DataNotFound          bool `json:"data_not_found,omitempty"`
	InternalServerError   bool `json:"internal_server_error,omitempty"`
	DataDuplicate         bool `json:"data_duplicate,omitempty"`
	QueryError            bool `json:"query_error,omitempty"`
	InvalidPasswordLength bool `json:"invalid_password_length,omitempty"`
	IsPassTheLimit        bool `json:"is_pass_the_limit,omitempty"`
	IsTimeOut             bool `json:"is_time_out,omitempty"`
	AttemptNotFound       bool `json:"attempt_not_found,omitempty"`
	Forbidden             bool `json:"forbidden,omitempty"`
	ValidationError       bool `json:"validation_error,omitempty"`

	// quiz context
	QuizTimeExpired     bool `json:"quiz_time_expired,omitempty"`
	QuizAlreadyPassed   bool `json:"quiz_already_passed,omitempty"`
	QuizAttemptLimit    bool `json:"quiz_attempt_limit,omitempty"`
	QuizAlreadyFinished bool `json:"quiz_already_finished,omitempty"`
	AcademyNotFinished  bool `json:"academy_not_finished,omitempty"`

	Message               string                    `json:"message,omitempty"`
	Err                   error                     `json:"-"`
	ValidationErrorFields []validation.ErrorMessage `json:"validation_error_fields,omitempty"`
}

func (a Exception) Error() string {
	return a.Err.Error()
}