Re: Best way for handle missing args in REST interface in vibed

2017-05-30 Thread Suliman via Digitalmars-d-learn
I had post question here http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/43511/

Re: Best way for handle missing args in REST interface in vibed

2017-05-29 Thread Suliman via Digitalmars-d-learn
@rootPathFromName interface API { @path("mytrack") @method(HTTPMethod.GET)Json doTrackSpeedAnalyze(int trackid, string startDateTime, string endDateTime); } class MyRouter : API { Config config; Database database; this(Config config, Database database) {

Re: Best way for handle missing args in REST interface in vibed

2017-05-29 Thread Suliman via Digitalmars-d-learn
I wrote next code: void foo(string _error = null) { writeln("Error"); } override: @errorDisplay!foo Json doTrackSpeedAnalyze(int trackid, string startDateTime, string endDateTime) // /api/mytrack?trackid=123=2000=2010 {

Re: Best way for handle missing args in REST interface in vibed

2017-05-29 Thread Nicholas Wilson via Digitalmars-d-learn
On Monday, 29 May 2017 at 12:23:59 UTC, Suliman wrote: I am doing REST interface with vibed. And thinking about handling errors, if users forgot to pass all expected args in function. For example: foo(int x, int y) // get request { } /api/foo?x=111 And if user is forgot to pass `y` we will

Re: Best way for handle missing args in REST interface in vibed

2017-05-29 Thread Suliman via Digitalmars-d-learn
On Monday, 29 May 2017 at 12:23:59 UTC, Suliman wrote: I am doing REST interface with vibed. And thinking about handling errors, if users forgot to pass all expected args in function. For example: foo(int x, int y) // get request { } /api/foo?x=111 And if user is forgot to pass `y` we will

Best way for handle missing args in REST interface in vibed

2017-05-29 Thread Suliman via Digitalmars-d-learn
I am doing REST interface with vibed. And thinking about handling errors, if users forgot to pass all expected args in function. For example: foo(int x, int y) // get request { } /api/foo?x=111 And if user is forgot to pass `y` we will get error in the browser. What is the right way to