superMap, get server response

Can someone suggest me a way (if any) to intercept the server response when requesting a CRUD action using can-connect/can/super-map/super-map?

For instance, after executing calling the save() method on the superMap object, if the server replies with an existing id entry (id as idProp), the instance properties will be updated (otherwise created). But if i want to handle errors caming from the server, sending back a special message, is it possible to get it before the updateData() is executed?

Thank you.

Configuring superMap in that way isn’t really possible. But if you build your own connection, all things are possible.

What do you mean by special message? Do you mean set a special property?

To build your own connection, I usually copy superMap's code: https://github.com/canjs/can-connect/blob/master/can/super-map/super-map.js

And then add my own behavior to the end:

behaviors.push(function(base){
  return {
    updateData: function(){
      
    }
  }
})

It sounds to me like you more want to overwrite createdInstance or updatedInstance: http://v3.canjs.com/doc/can-connect/constructor/constructor.createdInstance.html

Thank for your suggestion, justin!
I will try that way.

For special message I mean, for instance, an error code and description, to be sent back from the server in case of failure of the update operation.

PUT /my/resource/1
with data { fied1: "a", field2:"b"}

the server will reply
{field1:"a", field2:"b"} // if success
{error:"unable to save due to blabla...", code:123} // if error occurs

The save problem I have when connection to the server fails ( ajax goes to error): it is possible to catch this event?

Thank you a lot.

by catch the event do you mean:

modelInstance.save().catch(function(error){

})

Then yes … that is exactly how you do it.