-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supports @throws tag #135
Comments
+1 |
1 similar comment
👍 |
Definitely a must-have! |
Yes, please. |
+1 this would have a great impact on 'cross-language' documenting :) |
+1 |
Looks like there's some good support for this issue being implemented. In JS throw will always be a vanilla error object, would the tag need to support any other types for other languages? |
Throw may not always be an error object, it can be any type throw 'problem' throw callbackToReattemptFailedAction
|
And in fact I was even recently considering using throw as an api throw {returnValue: uniqueReturnValue};
|
I also like to use custom error objects, a js guru describes how to make Not sure what to do with this info.. maybe yui just links that error type
|
@devinrhode2 indeed, I actually realized this on the way home last night and then forgot to update my comment. Thanks for the link to the Zakas post. So, the tag should definitely support arbitrary classes for the error types. And, we should link to the local class definition or out to the ECMA definition if the specified type is one of the 7 defined by ECMA-262 5th under sections 15.11.6.1-15.11.6.6 plus the top level Error class. |
Super official. I like it, but most people probably want to see the mdn I don't know what linking conventions yuidoc currently has, should probably On Jul 25, 2013 8:49 AM, "Alexander Shusta" notifications@github.com
|
In PHP you can throw any class that extends the built-in Exception.
|
Does anyone know if there are workarounds to this, I have a method that must be implemented by a subclass, how do i indicate that. |
Bump, I am working on a project and am liking YUIDoc, but it would be great if we could get this done. Even something very simple would be nice, just a way to keep track and everything could be manual. |
🎱 I'm waiting for a volunteer to submit a PR, if any of you can do it, I promise that we will clean it up and merge it. :) |
I've had success using arbitrary annotations with YUIDoc. From my experience, just adding a For example: /**
* @method myMethod
* @throws {CustomErrorType} Watch out for this error!
*/
var myMethod = function() {
throw new CustomErrorType('You shouldn\'t have called this method. Shame on you.');
} Then in your The only tricky bit is that you have to find a way to parse the error type, and link to the So now you can do: {{#if throws}}
Throws:
{{#eachTypeInText throws}}
<a href="{{link}}">{{type}}</a>
{{/eachTypeInText
{{/if}} This will output: Throws: {<a href="/classes/CustomErrorType.html">CustomErrorType</a>} Watch out for this error! You'll probably want to flesh out the type helpers to get it formatted how you want. I hope this helps you out. |
More or less what I do with all "missing" tags. I customize all the templates anyway, since, really, with ALL the respect in the world, the default set of templates is, to put it mildly, lousy. |
@dnutels that's a fair comment, but antagonizing more than helpful. If everyone customizes the templates themselves for this sort of thing, yet doesn't help get their modifications in the mainline ---- well, a year goes by and the OP was never helped. Same goes for the theme as a whole. I don't like the default much, but it is functional. It is complicated to modify the current theme in a non-trivial way, so I think that many keep the default even though they would prefer something else. If you have spent time creating a better theme, it would be nice to get your thoughts and maybe some code to improve the default. |
@apm Wasn't trying to be controversial, more approving of the above comment - since the solution (or rather a WA) involves template fiddling. Can't share a specific theme, however. |
The reason I chose YUIDoc over JSDoc was exactly because of this: the templates are very extensible, and you have (mostly) direct access to parsed annotation data. Non-trivial changes took a bit more work than I originally hoped, but overall I've been very happy with YUIDoc. Rather than adding new annotations to YUIDoc, I would love to see improvements which make it easier in general to customize templates and annotations. For example, the proposed /**
* @tag {Type} name Description.
*/ As I mentioned, you can get the raw tag: {
"name": "name",
"type": "Type"
"description": "Description."
} Another use case I've thought of would be @dnutels I'd really like to contribute some of these changes to the YUIDoc library -- maybe once we make it past some deadlines at my work. In the meantime, we're about to open source our library, including the YUIDoc themes. If you're interested, maybe I can get you early access. |
Thanks for your waiting. #305 is ready for review. |
awesome 👍 🎆 |
Exceptions are quite handy when working on a number of languages.
It is essential that those are documented, so a need arises.
The text was updated successfully, but these errors were encountered: