• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
trouble Receiving text from error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

trouble Receiving text from error


  • Subject: trouble Receiving text from error
  • From: NICEMAC LLC Support <email@hidden>
  • Date: Wed, 06 Apr 2011 00:27:11 -0400

I am downloading contents of a URL using:

 property myEncoding : 4 --code for UTF8

    property myError : reference -- had to set this error parameter to 'missing value'. Only way I could get it not to complain in the console

    property myDownloadURL : "http://www.ni-cemac.com" as string -- just an example URL for testing


 tell class "NSURL" of current application

      set myURL to URLWithString_(MyDownloadURL)

 end tell

        


  tell class "NSString" of current application

        set DownloadData to stringWithContentsOfURL_encoding_error_(myURL, myEncoding, myError)

  end tell

        

  log item 2 of DownloadData



-- result:


2011-04-06 00:18:28.451 DownloadURL[1422:903] Error Domain=NSCocoaErrorDomain Code=260 UserInfo=0x200543640 "The file couldn’t be opened because it doesn’t exist." Underlying Error=(Error Domain=NSURLErrorDomain Code=-1003 UserInfo=0x200545a00 "A server with the specified hostname could not be found." Underlying Error=(Error Domain=kCFErrorDomainCFNetwork Code=-1003 UserInfo=0x2005446c0 "A server with the specified hostname could not be found."))


Trying to trap the error in my app:

I am forcing an error with an invalid URL.  I can log the error in the console, but would like to be able to read the text of this error in my app, "A server with the specified hostname could not be found."  '


Todd

nicemac




On Tue, Apr 5, 2011 at 3:01 PM, <email@hidden> wrote:
Send applescriptobjc-dev mailing list submissions to
       email@hidden

To subscribe or unsubscribe via the World Wide Web, visit
       http://lists.apple.com/mailman/listinfo/applescriptobjc-dev
or, via email, send a message with subject or body 'help' to
       email@hidden

You can reach the person managing the list at
       email@hidden

When replying, please edit your Subject line so it is more specific
than "Re: Contents of applescriptobjc-dev digest..."


Today's Topics:

  1. Re: Nsbundle help? (email@hidden)


----------------------------------------------------------------------

Message: 1
Date: Tue, 05 Apr 2011 17:21:21 +0100
From: "email@hidden" <email@hidden>
Subject: Re: Nsbundle help?
To: email@hidden
Message-ID: <email@hidden">email@hidden>
Content-Type: text/plain; charset="us-ascii"



On 3 Apr 2011, at 02:31, John C. Welch wrote:
>
> tell current application's NSBundle to set theBundle to bundleWithIdentifier_(theBundleID)
> Which would then allow me to do things like:
>
> set my theBundlePath to theBundle's executablePath()
>
> However, when I try that one, I get:
>
> [<NSObject 0x7fff70154468> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key theBundlePath.
>

Try it without the 'my' if you want to set a local variable named theBundlePath.
Otherwise you probably need to define an NSObject class property  named theBundlePath.


Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.apple.com/pipermail/applescriptobjc-dev/attachments/20110405/65c8ba1b/attachment.html

------------------------------

_______________________________________________
applescriptobjc-dev mailing list
email@hidden
http://lists.apple.com/mailman/listinfo/applescriptobjc-dev


End of applescriptobjc-dev Digest, Vol 17, Issue 3
**************************************************

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Nsbundle help?
  • Next by Date: Re: Which sender is which
  • Previous by thread: Re: Nsbundle help?
  • Next by thread: Re: Which sender is which
  • Index(es):
    • Date
    • Thread