Re: [WebDNA] try/except

This WebDNA talk-list message is from

2015


It keeps the original formatting.
numero = 111856
interpreted = N
texte = Very interesting. I=92ll have to go dig up and play with that database.=20= So here=92s an odd thing, setting a text variable inside an append still = works, even if the append fails. handy to find if an append fails to suspend any chained database = operations. example (again given a database =91test.db' that can not be written to: [text]testid=3Dblar[/text] [testid]
[append = db=3D^data/test.db&AUTONUMBER=3DID][text]testid=3D[thisautonumber][/text]f= ield1=3Dyes&field2=3Dno[/append]
[showif [testid]=3D]an error occured
[/showif] shows the error message. > On Jan 12, 2015, at 1:22 PM, Kenneth Grome = wrote: >=20 > Just edit the correct record in errorMessages.db and it will send > you email in this situation. >=20 > Then put the append context inside an html comment to hide it from > the visitor in case an error is generated. >=20 > Regards, > Kenneth Grome > WebDNA Solutions > http://www.webdnasolutions.com > Web Database Systems and Linux Server Management >=20 >=20 > On 01/12/2015 01:00 PM, Brian Burton wrote: >> Just discovered a lovely little problem involving appending records = to a database, the database having the wrong owner or permissions or = whatever (Thanks Obama Unix> and website users being = oblivious to the ugly error message webdna kicked out that displayed at = the top of the page.=20 >>=20 >> steps to reproduce: >> create a database that webdna can=92t write to because of incorrect = permissions (test.db) >>=20 >> [append db=3D^data/test.db]field1=3Dyes&field2=3Dno[/append] >> will yield: >> Error: Permision deny. Unable to append to 'test.db' .Ignoring = [Append] context. >>=20 >> if turns out this works: >> [showif [append db=3Dtest.db]field1=3Dyes&field2=3Dno[/append]~Error]a = problem was encountered[/showif] >>=20 >> but it=92s U.G.L.Y.=20 >>=20 >> what would be nice: >>=20 >> [try] >> [append db=3D^data/test.db]field1=3Dyes&field2=3Dno[/append] >> [except] >> [sendmail to=3Dme&from=3Dwebserver] Problems. Problems = EVERYWHERE! [/sendmail] >> [/except] >> [/try] >>=20 >>=20 >> I realize this won=92t get used often, but there are occasionally = some database operations where failure is not an option, and an admin = needs to get alerted directly is something goes wrong.=20 >>=20 >> -BBB >=20 Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] try/except (Kenneth Grome 2015)
  2. Re: [WebDNA] try/except (Brian Burton 2015)
  3. Re: [WebDNA] try/except (Kenneth Grome 2015)
  4. [WebDNA] try/except (Brian Burton 2015)
Very interesting. I=92ll have to go dig up and play with that database.=20= So here=92s an odd thing, setting a text variable inside an append still = works, even if the append fails. handy to find if an append fails to suspend any chained database = operations. example (again given a database =91test.db' that can not be written to: [text]testid=3Dblar[/text] [testid]
[append = db=3D^data/test.db&AUTONUMBER=3DID][text]testid=3D[thisautonumber][/text]f= ield1=3Dyes&field2=3Dno[/append]
[showif [testid]=3D]an error occured
[/showif] shows the error message. > On Jan 12, 2015, at 1:22 PM, Kenneth Grome = wrote: >=20 > Just edit the correct record in errorMessages.db and it will send > you email in this situation. >=20 > Then put the append context inside an html comment to hide it from > the visitor in case an error is generated. >=20 > Regards, > Kenneth Grome > WebDNA Solutions > http://www.webdnasolutions.com > Web Database Systems and Linux Server Management >=20 >=20 > On 01/12/2015 01:00 PM, Brian Burton wrote: >> Just discovered a lovely little problem involving appending records = to a database, the database having the wrong owner or permissions or = whatever (Thanks Obama Unix> and website users being = oblivious to the ugly error message webdna kicked out that displayed at = the top of the page.=20 >>=20 >> steps to reproduce: >> create a database that webdna can=92t write to because of incorrect = permissions (test.db) >>=20 >> [append db=3D^data/test.db]field1=3Dyes&field2=3Dno[/append] >> will yield: >> Error: Permision deny. Unable to append to 'test.db' .Ignoring = [append] context. >>=20 >> if turns out this works: >> [showif [append db=3Dtest.db]field1=3Dyes&field2=3Dno[/append]~Error]a = problem was encountered[/showif] >>=20 >> but it=92s U.G.L.Y.=20 >>=20 >> what would be nice: >>=20 >> [try] >> [append db=3D^data/test.db]field1=3Dyes&field2=3Dno[/append] >> [except] >> [sendmail to=3Dme&from=3Dwebserver] Problems. Problems = EVERYWHERE! [/sendmail] >> [/except] >> [/try] >>=20 >>=20 >> I realize this won=92t get used often, but there are occasionally = some database operations where failure is not an option, and an admin = needs to get alerted directly is something goes wrong.=20 >>=20 >> -BBB >=20 Brian Burton

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Change Subtotal (2000) Proposed FormVariables hierarchy (2000) Search returns all, not 20 (1997) Cobalt (2001) [WebDNA] [text scope=global show=F]... the 'show' param breaks (2010) searchable list archive (1997) PDF Writefile problem (2005) Displaying text and populating form fields (2005) stumped on simple sort (1999) find with exceptions (1997) HomePage Caution (1997) Taxable Shipping (2003) [AppendFile] problem (WebCat2b13 Mac .acgi) (1997) [ot] Bluetooth Phones That Allow SSH (2004) Getting total number of items ordered (1997) File upload woes (1998) Dealing with da back button (1999) Restart of DBserver (1997) question: back button prevention (1997) Help name our technology! I found it (1997)