3 Replies Latest reply on Jul 11, 2018 4:03 PM by thatJeffSmith-Oracle

    ORDS spits `ORA-01403: no data found` exception in every unclear situation

    Denis Savenko

      Why ORDS implementation is so that every time when something is wrong with ORDS metadata for the current schema, it returns `ORA-01403: no data found` exception? Why these exceptions are not wrapped with something meaningful? Like `REST access is not enabled for the schema` or `Module {module_name} does not exist`?

       

      Examples of what happens:

       

      Try to define a module when a developer didn't invoke `ords.enable_schema()` first (or forgot they are logged in as another schema user):

      begin
        ords.define_module(
          p_module_name    => 'root',
          p_base_path      => '/',
          p_items_per_page => 0);
      
      
          commit;
      end;
      /
      
      ORA-01403: no data found
      ORA-06512: at "ORDS_METADATA.ORDS_INTERNAL", line 617
      ORA-06512: at "ORDS_METADATA.ORDS_SECURITY", line 85
      ORA-06512: at "ORDS_METADATA.ORDS", line 725
      ORA-06512: at line 2
      

       

      Try to define a template when ORDS is not enabled for the schema or when there's no such module (seriously, don't you think the developer should be able to know the actual reason of the issue):

      begin
        ords.define_template(
         p_module_name    => 'root',
         p_pattern        => 'test/1.0/');
      end;
      
      ORA-01403: no data found
      ORA-06512: at "ORDS_METADATA.ORDS_INTERNAL", line 617
      ORA-06512: at "ORDS_METADATA.ORDS_SECURITY", line 85
      ORA-06512: at "ORDS_METADATA.ORDS", line 799
      ORA-06512: at line 2
      

       

      Try to define a handler when ORDS is not enabled for the schema, or there's no such module or there's no such template (the further we go the more intransparent the exception becomes):

      begin
          ords.define_handler(
          p_module_name    => 'root',
          p_pattern        => 'test/1.0/',
          p_method         => 'GET',
          p_source_type    => ords.source_type_plsql,
          p_source         =>
            'begin
              htp.p(''test'');
            end;',
          p_items_per_page => 0);
      end;
      
      ORA-01403: no data found
      ORA-06512: at "ORDS_METADATA.ORDS_INTERNAL", line 617
      ORA-06512: at "ORDS_METADATA.ORDS_SECURITY", line 85
      ORA-06512: at "ORDS_METADATA.ORDS", line 826
      ORA-06512: at line 2
      

       

      And so on.

       

      So, the question is - why weren't these exceptions made a little bit more meaningful?

       

      I thought ORDS is one of the most hopeful Oracle products. Why then there's no care about its users?

       

      Tested on ORDS 3.0, 17.4, 18.1