azure method blows up if the records does not exist -
i using method azure mobile services tutorial: await todotable.lookupasync(id)
. have 2 rows in table of id 1,2. if await todotable.lookupasync(1)
, works , return record. if await todotable.lookupasync(8)
see how it's going handle null, blows not found exception.
thanks on this.
null
mean there is record id = 8
, value `null'. in case do not have record. different.
what observe should observe if do not have record.
and standard rest based http services. if record not there, http 404
service.
azure mobile services nothing more combination of web api , wrapping (plumbing) code application. , every web api call non-existent record result http 404 error.
and said in comments, should wrap code around try - catch
blocks , inspect exception.
in .net 4.5/4.6 there new httpclient type along httpresponsemessage , httprequestmessatge. former has ensuresuccessstatuscode() method. which, if called trigger exception.
in older versions of framework there webclient class, throw exception if http status code not 200.
so, again, @ end - observe absolutely normal behavoir. have read little more http rest services, http verbs , http status codes. understand how particular framework use (.net) handles http status codes.
Comments
Post a Comment