Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tom 120 posts 448 karma points
    Dec 10, 2014 @ 13:22
    Tom
    0

    handle contentResource 404 error

    hi,

    i'm trying to use the contentResource.getById(id) to check if a certain document exists from angularjs in a property editor. But I get a 404 and an red error in the backend, if the node doesn't exist.

    i have tried try catch around it - but it still shows an error.

    i've also thought about the possibility of changing the "then" to "ifSuccess" or something like that, but can't find any documentation on this.

    how do i handle when the node doesn't exist?

    contentResource.getById(id).then(function (content) {
      //do stuff....
    });
    
  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 10, 2014 @ 13:25
    Jan Skovgaard
    100

    Hi Tom

    You should be able to handle it like this

    contentResource.getById(id).then(function(content){
      //Do stuff...
    }, function(error){
      // Do error handling stuff
    });
    

    Does this work for you?

    /Jan

  • Tom 120 posts 448 karma points
    Dec 10, 2014 @ 13:28
    Tom
    0

    hi jan

    thanks - that worked. now i can handle the errors - but is there any way to kill the build-in error overlay thingy?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 10, 2014 @ 13:41
    Jan Skovgaard
    0

    Hi Tom

    Hmm, I'm not sure the defaults can be overwritten but if it can I suppose it should be mentioned here http://umbraco.github.io/Belle/#/api/umbraco.services.dialogService (Have only skimmed it myself though).

    Hope this helps.

    /Jan

  • Tom 120 posts 448 karma points
    Dec 10, 2014 @ 14:13
    Tom
    0

    created my own webapi to check if the documents exists

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 10, 2014 @ 14:25
    Jan Skovgaard
    0

    Hi Tom

    Cool - Glad you got it all working :)

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft