View Issue Details

IDProjectCategoryView StatusLast Update
0025162mantisbtplug-inspublic2019-05-09 12:08
ReporterfmanAssigned Todregad 
PrioritynormalSeverityfeatureReproducibilityalways
Status assignedResolutionopen 
Product Version2.19.0 
Target Version2.22.0Fixed in Version 
Summary0025162: Improve plugin schema upgrade error message
Description

While developing plugins is easier to have issues due to minor errors.
I've found difficult to understand what is happening when I got an error like:

<b>Upgrading the plugin schema failed in block #10<b>

After digging a little bit on the code I've understood that the #NUMBER is the element of the array returned by the schema() that I've created.
IMHO may be the word block can be changed to something a little bit clear.

My proposal is a silly one:
adding the offending sentence ($t_sqlarray)

    if( 2 == $t_status ) {
        plugin_config_set( 'schema', $i );
    } else {
        <b>error_parameters( $i . ' SQL: ' . json_encode($t_sqlarray) );</b>
        trigger_error( ERROR_PLUGIN_UPGRADE_FAILED, ERROR );
        return null;
    }

regards

TagsNo tags attached.

Activities

dregad

dregad

2019-05-09 06:28

developer   ~0062046

I agree that providing details / context about the error would be a useful addition to plugin API.

Displaying the offending SQL statement would be useful for context, but I don't think that the suggestion to insert JSON within the error message is the right approach.

It would be even more useful to provide the actual error message returned by the DB (i.e. $g_db->errorMsg()).

dregad

dregad

2019-05-09 12:08

developer   ~0062047

PR https://github.com/mantisbt/mantisbt/pull/1511

Issue History

Date Modified Username Field Change
2019-01-07 09:49 fman New Issue
2019-05-09 06:28 dregad Assigned To => dregad
2019-05-09 06:28 dregad Status new => assigned
2019-05-09 06:28 dregad Target Version => 2.22.0
2019-05-09 06:28 dregad Summary More feedback on schema management => Improve plugin schema upgrade errors
2019-05-09 06:28 dregad Note Added: 0062046
2019-05-09 12:01 dregad Summary Improve plugin schema upgrade errors => Improve plugin schema upgrade error message
2019-05-09 12:08 dregad Note Added: 0062047