I have created a custom web part which presents a form to create a SharePoint site below the current site, while performing some ancillary actions like updating a list of subsites on the front page to include the newly created subsite.
Development has, as per Microsoft guidelines, been performed on a SharePoint Foundation box which closely resembles the environment in Microsoft Online. Deployment and testing on this test machine is obviously as a sandboxed solution. Before adding the web part to the SharePoint Online gallery, I put a generic try-catch around all my code to be able to pick up any error messages in the production environment, where no debugger is available.
The web part does indeed work (the subsite is created), but at some undeterminable point after this, execution stops with "Web Part Error: Sandboxed Code Execution Request Failed". This is a generic error message which circumvents my try-catch. Presumably, I am doing something that the Sandboxed Code Service doesn't like. But the code works fine in the sandboxed server environment.
Is there any way to get a more specific error message? Does anyone have experience developing sandboxed solutions for SharePoint Online and know if there are any less painful practices? I guess I could do a "manual search" and comment out each individual line of code where my error could be, but this is a ridiculously painful approach.