On Lua Parser Error

Discussion about using Moai Cloud - post questions, bugs and issues here.

On Lua Parser Error

Postby pip010 » Tue Mar 06, 2012 11:22 am

Hi guys,
maybe I've missed something,but how exactly do you debug cloud hosted lua code?

Right now I have some probably lexical error and all I got from my response is empty string!

Can I make so that I got the lua interpreter error instead? or anything meaningful :)

either that or local sandbox.

preferably both! :)

:?
pip010
 
Posts: 18
Joined: Wed Feb 29, 2012 4:35 am

Re: On Lua Parser Error

Postby bonozogames » Tue Mar 06, 2012 3:22 pm

I believe lua syntax errors are, in fact, output to the browser. If you are not getting any, you may need to return your own debug info to the browser:

Code: Select all
  1. web:page( debug_info, 200, 'OK')



And of course, logging can be very useful to debug:

Code: Select all
  1. moai.log( json.encode( result ), "INFO" )



...which will put a table named 'result' in a collection called "logs".
User avatar
bonozogames
 
Posts: 170
Joined: Sat Nov 05, 2011 9:17 pm
Location: Tulsa, OK

Re: On Lua Parser Error

Postby ibisum » Wed Mar 07, 2012 2:03 am

I think this warrants a bit of attention from the moai-cloud cognescenti who have already deployed stuff .. an article on the methodology of development->deployment to the moai-cloud would be very useful for those of us still bootstrapping our skills.
;
--
ibisum@gmail.com
Got a MOAI snippet? Please consider adding it to http://moaisnippets.info
User avatar
ibisum
 
Posts: 1026
Joined: Mon Oct 17, 2011 1:11 am
Location: Vienna, Austria

Re: On Lua Parser Error

Postby rob » Thu Mar 08, 2012 3:34 pm

The development->deployment process is something I would like to overhaul, so I would really love it for users to let me know how they would like to work. The way it currently functions is that you have 3 ways to modify code in the cloud and two ways to add new files to the cloud

1) Upload a zip will overwrite all of you code and replace with the contents of the zip. This is the only way to add a directory
2) Upload an individual file. This will overwrite an existing file with the same name or add the file if it is new.
3) Edit an existing file in the code editor.

When I developing a service I usually create my structure offline and then do my first upload through a zip file. For additional changes I make them offline in my editor and then either copy and paste into the cloud code editor or upload the file. I don't like this workflow.

Some of the options I've been thinking about include:

1) git push
From my local machine issue a command like git push moai <branch>. This would take my local code tree and upload everything to the cloud.
2) github pull
From the dashboard pull any branch from github into my cloud service
3) sshfs
Allow me to mount my cloud services code so I can edit locally via my ide but save changes to the cloud immediatly.

You can get yourself in trouble by mixing these methods since you have multiple mastes. i.e. if you edit the file in the cloud and locally you will have a hard time merging. We've also been thinking about automatic versioning and rollback in the cloud so each time you save a file we'll keep that history and allow you to revert.

If ay one has thoughts or feedback leave them here or on (preferably) our feedback page:

https://moaicloud.uservoice.com/forums/137991-features
rob
 
Posts: 116
Joined: Wed Sep 21, 2011 2:34 pm

Re: On Lua Parser Error

Postby rob » Thu Mar 08, 2012 3:39 pm

Reading this thread a little more closely, if there is a syntax error in your code that should be returned to you in the browser. We will eventually make that feature a setting you can toggle in your dashboard so your code isn't returned whenever an error is detected.

For logic errors you'll have to either use our logging infrastructure, or output messages to the browser as you go along. We will be improving our logging infrastructure shortly so that should become a more viable way to debug.

We also have an 'idea' on our feedback page for allowing remote debugging. That is a rather large project but I certainly see the value in it. If enough people are interested in it we could move it up. Lastly I've also been working on an offline sandbox, but it requires you to have mongodb installed. If enough people upvote that I could move it up on the priority list.
rob
 
Posts: 116
Joined: Wed Sep 21, 2011 2:34 pm

Re: On Lua Parser Error

Postby pip010 » Sun Mar 11, 2012 10:14 am

bonozogames wrote:I believe lua syntax errors are, in fact, output to the browser. If you are not getting any, you may need to return your own debug info to the browser:

Code: Select all
  1. web:page( debug_info, 200, 'OK')



And of course, logging can be very useful to debug:

Code: Select all
  1. moai.log( json.encode( result ), "INFO" )



...which will put a table named 'result' in a collection called "logs".


nope i dont get syntax error as output, i get empty string :(
and logging doest help much in such a case :(

BTW is there something magical about the var debug_info ? or you mean to use it as debuging string? (cause again it wont work)
pip010
 
Posts: 18
Joined: Wed Feb 29, 2012 4:35 am

Re: On Lua Parser Error

Postby rob » Sun Mar 11, 2012 1:28 pm

Syntax errors should be sent to the browser window. If you can pm me your code I can take a look at it to see why you aren't getting them.

There is nothing special about debug_info, that was just used as an example.
rob
 
Posts: 116
Joined: Wed Sep 21, 2011 2:34 pm


Return to Moai Cloud

Who is online

Users browsing this forum: No registered users and 0 guests

cron

x