jacomyal / domino.js

[deprecated] A JavaScript cascading controller for fast interactive Web interfaces prototyping.
https://jacomyal.github.io/domino.js
MIT License
54 stars 7 forks source link

Error / success mismatch on service (may be linked to 'expect') #7

Closed jacomyma closed 11 years ago

jacomyma commented 11 years ago

I use a service with 'expect' and 'error' functions. I have a backend issue that makes the query fail and the 'expect' clause is not satisfied. My 'error' function correctly triggers, but the log says it is 'successfull'. Here is my service:

{
                id: 'setCurrentWebEntityStatus'
                ,setter: 'statusValidation'
                ,data: function(settings){  return JSON.stringify({ //JSON RPC
                        'method' : HYPHE_API.WEBENTITY.SET_STATUS,
                        'params' : [
                            settings.shortcuts.webEntityId      // web entity id
                            ,settings.shortcuts.status          // new status
                        ],
                    })}
                ,path:'0.result'
                ,url: HYPHE_CONFIG.SERVER_ADDRESS, contentType: 'application/x-www-form-urlencoded', type: 'POST'
                ,expect: function(data){return data[0].code == 'success'}
                ,error: function(data){alert('Oops, an error occurred... \n\nThe server says:\n'+data)}
            }

And here is the log: [domino] Calling service "setCurrentWebEntityStatus". domino.js:1527 [domino] Service "setCurrentWebEntityStatus" successfull.

jacomyal commented 11 years ago

Thanks, I just checked: the log is displayed before the expect callback is triggered. I'll fix it ASAP.