Skip to content

Commit

Permalink
panic handler
Browse files Browse the repository at this point in the history
  • Loading branch information
agiledragon committed Jun 25, 2018
1 parent d92988d commit 0a39ded
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions cargo/domain/service/cargo_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,18 @@ func (t *CargoService) Create(cargoId string, afterDays uint) {

func (t *CargoService) Delay(cargoId string, days uint) {
cargo := t.repo.Get(cargoId)
if cargo != nil {
cargo.Delay(days)
t.repo.Update(cargo)
t.provider.Confirm(cargo)
if cargo == nil {
panic("not found cargo by cargoId")
}
cargo.Delay(days)
t.repo.Update(cargo)
t.provider.Confirm(cargo)
}

func (t *CargoService) GetAfterDays(cargoId string) uint {
cargo := t.repo.Get(cargoId)
if cargo != nil {
return cargo.GetAfterDays()
if cargo == nil {
panic("not found cargo by cargoId")
}
panic("invalid cargoId")
return cargo.GetAfterDays()
}

0 comments on commit 0a39ded

Please sign in to comment.