Search code examples
actionscript-3apache-flexexceptionactionscriptflash-builder

Understanding the ActionScript API - can this statement throw an exception?


I want to know whether I should wrap the following statement in a try catch block:

var newFile:File = File.applicationStorageDirectory.resolvePath(fileName);

If I look at the API Reference for resolvePath() and applicationStorageDirectory, it mentions nothing about throwing exceptions.

Am I understanding this correctly?


Solution

  • I just tried it out. It will throw an error if fileName is null. -> ArgumentError: Error #2007: Parameter must be non-null. But it's better to test if fileName is null before than using a try catch.