Skip to content

Commit

Permalink
reuse WP_Error response instead of creating a new one
Browse files Browse the repository at this point in the history
Co-authored-by: Tonya Mork <tonya.mork@automattic.com>
  • Loading branch information
matiasbenedetto and hellofromtonya committed Aug 23, 2023
1 parent 21dfbe3 commit fb913af
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,7 @@ public function get_font_collection( $request ) {
$collection = WP_Font_Library::get_font_collection( $id );

if ( is_wp_error( $collection ) ) {
return new WP_Error(
'font_collection_not_found',
__( 'Font collection not found.', 'gutenberg' ),
array( 'status' => 404 )
);
return $collection;
}

return new WP_REST_Response( $collection->get_data() );
Expand Down

0 comments on commit fb913af

Please sign in to comment.