Search Results

Search found 2 results on 1 pages for 'dietbuddha'.

Page 1/1 | 1 

  • Why is nesting or piggybacking errors within errors bad in general?

    - by dietbuddha
    Why is nesting or piggybacking errors within errors bad in general? To me it seems bad intuitively, but I'm suspicious in that I cannot adequately articulate why it is bad. This may be because it is not in general bad and that it is only bad in specific instances. Why is it detrimental to design error/exception handling in such a way. The specific instance is that of a REST service. There is a desire by some to use http errors (specifically the 500 response) as a way to indicate any problem with specific instances of a resource. An example of an instance resource in this case would be: http://server/ticket/80 # instance http://server/ticket # not an instance So this is the behavior that is being proposed. If ticket 80 does not exist return a http response code of 500. Within the body of the error return the "real" error as an additional error code and description. If the ticket resource doesn't exist return a response code of 404.

    Read the article

  • Is there a name for this functional programming construct/pattern?

    - by dietbuddha
    I wrote a function and I'd like to find out if it is an implementation of some functional programming pattern or construct. I'd like to find out the name of this pattern or construct (if it exists)? I have a function which takes a list of functions and does this to them: wrap(fn1, fn2, fn3, fn4) # returns partial(fn4, partial(fn3, partial(fn2, fn1))) There are strong similarities to compose, reduce, and other fp metaprogramming constructs, since the functions are being arranged together and returned as one function. It also has strong similarities to decorators and Python context managers since it provides a way to encapsulate pre and post execution behaviors in one function. Which was the impetus for writing this function. I wanted the ability that context managers provide, but I wanted to be able to have it defined in one function, and to be able to layer function after function on top.

    Read the article

1