Skip to content

Commit

Permalink
Throw exception in case shipment misses id after save.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisnissle committed Jul 16, 2024
1 parent 1ddd2f1 commit 831c23c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -2978,6 +2978,10 @@ public function save() {
}
}

if ( ! $this->get_id() ) {
throw new \Exception( 'Error while saving shipment.' );
}

$this->save_items();

if ( $cache = Helper::get_cache_object( 'shipments' ) ) {
Expand Down

0 comments on commit 831c23c

Please sign in to comment.