azure


azure method blows up if the records does not exist


I am using this method from the azure mobile services tutorial:
await todoTable.LookupAsync(id). I have 2 rows in a table of id 1,2.
If i do await todoTable.LookupAsync(1), it works and return the record. If i do
await todoTable.LookupAsync(8) to see how it's going to handle null, it just blows up with Not Found exception.
Thanks for help on this.
NULL would mean there is a record for id = 8, but its value is `NULL'. But in your case you do not have a record. Which is different.
What you observe is what you should observe if you do not have a record.
And this is a standard for REST based HTTP services. If record is not there, you get an HTTP 404 from the service.
Azure mobile services is nothing more than a combination of Web API and a wrapping (plumbing) code for your application. And every Web API call to a non-existent record would result into an HTTP 404 error.
And as already said in the comments, you should wrap your code around try - catch blocks and inspect the exception.
In .NET 4.5/4.6 there is new HttpClient type along with HttpResponseMessage and HttpRequestMessatge. The former has EnsureSuccessStatusCode() method. Which, if called will trigger exception.
In the older versions of the Framework there WebClient class, which would throw an exception if the HTTP status code is not 200.
So, again, at the end - you observe absolutely normal behavoir. Just have to read a little more about HTTP REST services, HTTP VERBS and HTTP Status Codes. Then also understand how the particular framework you use (.NET) handles the HTTP Status Codes.

Related Links

Dynamitey exception when accessing input DocumentDB with F# in Azure Functions
Buying a domain through azure fails
Azure Queue - Reappearing mesages
A Branding RBAC role for Azure
How to delete 200k files from a directory in Azure?
Behavior of Asterisk(*) in Azure Search Service
Copy page blob from one storage account to Another storage account using .Net API startCopy
Azure Active Directory: One user with multiple providers account
Azure Cloud Service - Bad Request on external computer
VSTS deployment fails with “Authorization failed for … of type 'Microsoft.Storage/storageAccounts/providers/locks'”
How Scale-out work in Azure App Services
Azure - Best practice to scale a single thread app based on pending items
traffic manager for https azure website
How to combine account credits for Azure servers
Monitoring Bing Maps API requests
Azure AD Graph API - Assigning a group with role to a tenant's application (ServicePrincipal)

Categories

HOME
amazon-s3
elastic-beanstalk
matlab
google-search
module
runnable
datetime
libreoffice
turing
logback
sony
jfreechart
asp.net-mvc-3
wso2ei
w3.css
google-cloud-sdk
facebook-opengraph
postgresql-9.5
condor
export-to-excel
installer
afnetworking-2
org-mode
cmusphinx
servlet-filters
swig
game-maker-language
semantics
sencha-touch-2
precision
naturallyspeaking
epicorerp
nested-loops
f2py
temp
charts.js
swipe
stackexchange.exceptional
detach
google-crawlers
double-click-advertising
draggable
msal
otroslogviewer
drupal-webform
h5py
csr
polymer-cli
quicksand
jquery-ui-dialog
gretl
smartbanner
sql-mode
mrtg
htc
attributerouting
javascript-security
singlepage
informatica-cloud
tfs2008
xceed
amazon-dynamodb-streams
activity-diagram
ng-annotate
submission
pypyodbc
cover
accounts
mutation
wand
sejda
openejb
ubiquity
json4s
monkeyrunner
xsb
translucency
keypad
theorem-proving
getuikit
typesafe-activator
bessel-functions
asf
monk
dynamic-typing
django-supervisor
xacml3
nine-patch
azimuth
notifyicon
showcaseview
ducttape
str-to-date
flash-cs4
polarssl
northwind
icon-fonts
dependency-walker
xsocket
rc-shell
squirrelmail
google-website-optimizer
sticky-footer
httpcontext.cache
springboard
closest
datatemplate
etrade-api
queryanalyzer
net-ssh
msn-messenger
iequalitycomparer
help-authoring
corporate-policy

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App