View | Details | Raw Unified | Return to bug 38926
Collapse All | Expand All

(-)a/Koha/REST/V1/Biblios.pm (-2 / +15 lines)
Lines 703-711 sub add { Link Here
703
            }
703
            }
704
        ) unless !$duplicatebiblionumber || $confirm_not_duplicate;
704
        ) unless !$duplicatebiblionumber || $confirm_not_duplicate;
705
705
706
        my ( $biblio_id ) = AddBiblio( $record, $frameworkcode, { record_source_id => $record_source_id } );
706
        my ($biblio_id) = C4::Biblio::AddBiblio( $record, $frameworkcode, { record_source_id => $record_source_id } );
707
707
708
        $c->render(
708
        if ( !$biblio_id ) {
709
710
            # FIXME: AddBiblio wraps everything inside a transaction and a try/catch block
711
            # this will need a tweak if this behavior changes
712
            return $c->render(
713
                status  => 400,
714
                openapi => {
715
                    error      => 'Error creating record',
716
                    error_code => 'record_creation_failed',
717
                },
718
            );
719
        }
720
721
        return $c->render(
709
            status  => 200,
722
            status  => 200,
710
            openapi => { id => $biblio_id }
723
            openapi => { id => $biblio_id }
711
        );
724
        );
(-)a/api/v1/swagger/paths/biblios.yaml (-2 / +4 lines)
Lines 29-35 Link Here
29
      "200":
29
      "200":
30
        description: A biblio
30
        description: A biblio
31
      "400":
31
      "400":
32
        description: Bad request
32
        description: |
33
          Bad request. Possible `error_code` attribute values:
34
35
            * `record_creation_failed`: An error occurred during record creation. The cause could not be determined.
33
        schema:
36
        schema:
34
          $ref: "../swagger.yaml#/definitions/error"
37
          $ref: "../swagger.yaml#/definitions/error"
35
      "401":
38
      "401":
36
- 

Return to bug 38926