Back to Recipes Homepage
recipe picture
Recipe: Safe Fun 1.3
Created by LociOiling 6 3
0
Your rating: None

Profile

Name: Safe Fun 1.3
ID: 103265
Created on: Sun, 02/23/2020 - 12:34
Updated on: Tue, 02/25/2020 - 23:51
Description:

Safe Fun demonstrates the use of the pcall function to trap errors. SafeFun tests many of the Foldit Lua functions for parameter errors, such as segment out of range. SafeFun allows testing functions by group, such as band, behavior, selection, and structure. Version 1.2 adds a dialog to allow control over which tests run. Version 1.3 refines error testing.



Best For


Comments

LociOiling's picture
User offline. Last seen 3 hours 56 min ago. Offline
Joined: 12/27/2012
Groups: Beta Folders
error trapping with pcall

Safe Fun tests many of the Foldit Lua functions for common parameter errors.

Safe Fun demonstrates the use of the Lua pcall function to trap errors which normally terminate a recipe. Each function tested has a wrapper function which handles the pcall and checks for specific errors.

Safe Fun lets you select functions by group:

behavior
contactmap
freeze
rotamer
selection
structure

Some of the newer functions are not yet included.

As of February 2020, segment range errors crash Foldit, so many of the groups will fail. The behavior group doesn't work with individual segments, so it can be used to test normal completion of the recipe.

LociOiling's picture
User offline. Last seen 3 hours 56 min ago. Offline
Joined: 12/27/2012
Groups: Beta Folders
added selecting tests by type

Version 1.2 expands the dialog to allow selecting test by type:

  • tests where the underlying function succeeds
  • tests for segment range errors
  • tests parameter value errors
  • tests for parameter count errors

By default, only the first and last of these types are checked. Segment range errors and at least some other parameter value errors cause a crash.

The "all groups" option is now true by default. To test specific groups, uncheck "all groups" and check the individual groups to be tested.

The default settings should result in a test run that doesn't crash the client. Unfortunately, the tests being skipped greatly outnumber the non-crashy ones.

LociOiling's picture
User offline. Last seen 3 hours 56 min ago. Offline
Joined: 12/27/2012
Groups: Beta Folders
another type, refined error checking

Version 1.3 allows testing for parameter type errors, along with the type of errors allowed in the previous version.

The error checking logic has been streamlined somewhat. The function CommonError is used to check for errors that may occur in several functions.

In two new return codes have been added. Return code -997 indicates a parameter type error, such as a boolean specified where a numeric was expected. Return code -998 indicates an error in the number of parameters specified.

The new features allow running a greater number of tests. Segment range errors still crash the client, along with atom number errors on certain band calls. Avoiding the band functions and the segment range error tests should result in a clean run, although it still means many tests are being skipped.

An uppercase "ERROR" appears in the scriptlog when there's an expected return code from one of the tests. Unexpected errors of this type appear in the "test failure" counts at the end of each function group and the very end of the recipe.

Want to try?
Add to Cookbook!
To download recipes to your cookbook, you need to have the game client running.
Parent

none

Children
Authors
Sitemap

Developed by: UW Center for Game Science, UW Institute for Protein Design, Northeastern University, Vanderbilt University Meiler Lab, UC Davis
Supported by: DARPA, NSF, NIH, HHMI, Amazon, Microsoft, Adobe, RosettaCommons