Sometimes they can be helpful for debugging and logging purposes. As a part of our eleventh example, we have demonstrated the usage of format_stack() method. Applications of super-mathematics to non-super mathematics. To subscribe to this RSS feed, copy and paste this URL into your RSS reader. Connect and share knowledge within a single location that is structured and easy to search. Learn in-demand tech skills in half the time. One branch is headed by Exception. Matching One or More Exceptions with try/catch Problem You want to catch one or more exceptions in a try/catch block. To subscribe to this RSS feed, copy and paste this URL into your RSS reader. printStackTrace outputs to System.err unless you provide a writer. This doesn't seem to be the case in IntelliJ, and while I do get the print outs from every "sout" declared within the classes, any thrown exceptions are . Some of them, you almost expect. I am only interested in printing "My message". Active Directory: Account Operators can delete Domain Admin accounts, Sci fi book about a character with an implant/enhanced capabilities who was hired to assassinate a member of elite society. "but the if/else statement gives me difficulty" What difficulty? Launching the CI/CD and R Collectives and community editing features for How to disable stack trace generation in a java program? This tutorial shows the best way I know to log exceptions. And sure, Steven I hate message like 'Problem happens . Thanks. We'll now explain the usage of these methods with simple examples one by one. But avoid Asking for help, clarification, or responding to other answers. throw . You can clear out the stack trace in the exception object with, Throw an exception without printing stack trace [closed], The open-source game engine youve been waiting for: Godot (Ep. Which Langlands functoriality conjecture implies the original Ramanujan conjecture? How can I recognize one? Currently the code, when it goes into exception, after printing "My message", also prints the stack trace. Anish Chakraborty 2 years ago. As a part of our ninth example, we'll demonstrate the usage of walk_tb() and StackSummary.extract() methods. Those two exceptions are caught in the catch block of this example. Your trouble is that although you can suppress the stacktrace of the exception your own code threw, there is nothing you can do about the exception it will be wrapped into by the framework. I should modify it so that the stack trace is no longer printed. But you really don't care about the stack trace there but its there. I should modify it so that the stack trace is no longer printed. The problem only occurs if I try to access Exception.getStackTrace. Provide details and share your research! @paradigmatic good point, the problem is that I believe in Play 2 Scala redirects have to occur within Action scope (e.g. The exception in Scala and that results in a value can be pattern matched in the catch block instead of providing a separate catch clause for each different exception. Is it good practice to use it, or should it be considered "internal" to scala and left alone? Stacktrace stacktrace_entry (C++23) basic_stacktrace (C++23) [edit] std::basic_stacktrace Member functions basic_stacktrace::basic_stacktrace (C++23) basic_stacktrace::~basic_stacktrace (C++23) basic_stacktrace::operator= (C++23) basic_stacktrace::current (C++23) basic_stacktrace::get_allocator (C++23) Iterators DSA; Data Structures. By using our site, you Can a VGA monitor be connected to parallel port? We can use the format_exc () method to print the stack trace with the try and except statements. As usual, if you have any questions, comments, corrections, or better examples, just leave a note in the comments section below. This makes your code consistent and easier to read, and you dont have to remember a special/different syntax. Format a stack trace and the exception information. This question has several ways to convert an exception stack trace to a String. By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. How to get an enum value from a string value in Java. How do I read / convert an InputStream into a String in Java? By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. System.Security.SecurityException when writing to Event Log, Difference between object and class in Scala, Useless stack trace in SetUnhandledExceptionFilter handler, Get exception description and stack trace which caused an exception, all as a string. 2. But this (using getStackTrace) itself causes "java.lang.OutOfMemoryError: PermGen space". How can I recognize one? Seems like a fairly straight forward problem, but I'd like to log a stack trace when my top level error handler in Scalatra is triggered. We can understand this with the help of this example. Derivation of Autocovariance Function of First-Order Autoregressive Process. I just wanted to know if it is possible to control the stack trace display when raising my own exception. Browse other questions tagged, Start here for a quick overview of the site, Detailed answers to any questions you might have, Discuss the workings and policies of this site. printStackTrace() is very useful in diagnosing exceptions. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions. Below we have explained the usage of the method with simple example. The only way - using GCC - to solve this is to make sure to generate . It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions. What is a stack trace, and how can I use it to debug my application errors? An exception is an unwanted or unexpected event, which occurs during the execution of a program i.e at run time. Is there something I can do at this point to grab the stacktrace? 32Mb is the default on a client-class machine by the way, The open-source game engine youve been waiting for: Godot (Ep. Overview In this quick tutorial, we'll show how to log exceptions in Java using the SLF4J API. One drawback of using Scala's wildcard character (_) in a catch clause is that you can't refer to it in your code, such as if you want to print the exception. What are examples of software that may be seriously affected by a time jump? What does a search warrant actually look like? How can I get the current stack trace in Java? Log a lot of data. But that decode throws a checked NumberFormatException. As with Java, you can throw an exception from a catch clause, but because Scala doesn't have checked exceptions, you don't need to specify that a . When you say "it prints", what is "it"? If a business exception occurs, the default behaviour will be to print the stack trace of that business exception (not the ExecutionException) and return an exit code. As a part of our seventh example, we'll explain usage of methods format_tb(), format_exception() and format_exc(). The contract of the execute method is that it will never throw an exception, and always return an exit code. What am I doing wrong? As a part of this tutorial, we'll be explaining how we can use a different method of traceback module for different purposes. The StringWriter code prints the following output, which is very readable as stack traces go: To be clear, you dont need this approach when using things like System.out.println or System.err.println; you can just use e.printStackTrace there, which prints to STDERR. How to find out who and from where called a method? Please make a note that parameter limit, file, and chain are present in multiple methods of traceback module and it has the same meaning in all of them. How does a fan in a turbofan engine suck air in? Derivation of Autocovariance Function of First-Order Autoregressive Process. The following are two methods of the StackElementExample class. It certainly seems fishy that getting a stack trace is exhausting your permgen space, but maybe if you can increase the memory to the point where you can actually examine the stack trace you'll be able to get some insight into what's going on. In the excellent book, Programmming Scala, the authors suggest naming your exception variable instead of using the wildcard, which you can then refer to in your own code, something like this: As you can see from that code, I just name a variable "unknown", which I can then refer to by name. Below we have explained the usage of it with simple example. as in example? rev2023.3.1.43266. To prove this, go to http://localhost:8080/errors/throw which has the ErrorController intentionally throw a NullPointerException using the following code: Exception npe = new NullPointerException("Forcing an exception to be thrown"); logger.error("Forcing an exception to be thrown and sent to logging framework",npe); In reviewing Java code from different developers at different organizations I see a lot of people working very hard to print a stack trace using Log4J, including a lot of variations of calling e.printStackTrace() method. This could be from a mistyped variable, incorrect input, or any type of exception that you've defined in your code. How to get stack trace of an exception in Scala to print it? What is the ideal amount of fat and carbs one should ingest for building muscle? Connect and share knowledge within a single location that is structured and easy to search. This ends our small tutorial explaining the usage of the traceback module. Can a VGA monitor be connected to parallel port? Here's a simple implementation: What is behind Duke's ear when he looks back at Paul right before applying seal to accept emperor's request to rule? When catching an exception, there are two options in case the exception should be rethrown: throw will just rethrow the original exception with the original stack, while throw e would have created a new stack trace. As a part of our fourth example, we have demonstrated how we can catch the exception and print stack trace using print_exception() method. To subscribe to this RSS feed, copy and paste this URL into your RSS reader. Please make a note that print_tb() only prints stack trace and does not print actual exception type. Can a VGA monitor be connected to parallel port? We have then retrieved traceback from the error object using traceback attribute of the error object and have given it to print_tb() method which prints a stack trace. This method works same as printStackTrace () but difference is only that it prints to specified print Writer passed as parameter. 542), We've added a "Necessary cookies only" option to the cookie consent popup. 3.3. In the array of stack trace elements (assuming the array's length is non-zero), each element represents one stack frame. Making statements based on opinion; back them up with references or personal experience. In a program of mine I'd like to catch all exceptions and explicitly print them (to be able to proceed with finally while still seeing exceptions). Please be sure to answer the question. But this - "maybe if you can increase the memory to the point where you can actually examine the stack trace you'll be able to get some insight into what's going on" - sounds rational, thanks for the idea. By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. Please make a note that when we used print_exception() method, it printed information about exceptions as well which was not getting printed with print_tb() method. If we want some part of our code to execute irrespective of how the expression terminates we can use a finally block. To learn more, see our tips on writing great . However, some users try to circumvent this by entering invalid dates in hopes of gaining free access to paid subscriber-only content. 1) The trace does not include the file / line at which the exception is thrown; that entry is only recorded in the top-level getFile/Line methods. By Alvin Alexander. For example: 1 2 3 4 5 6 7 8 9 } catch (StudentException ex) { try { It only takes a minute to sign up. println ("Input/output Exception") } } } } Output: Exception: File missing Here, the try block is executed first and if any exception is thrown then each of the cases of the catch clause is checked and the one which matches the exception thrown is returned as output. Ackermann Function without Recursion or Stack. Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide. There is three kinds of methods available with the traceback module. How to draw a truncated hexagonal tiling? It looks same as in Java. Exception handling in Scala is implemented differently, but it behaves exactly like Java and works seamlessly with existing Java libraries. But, if you're passing this on up the chain - don't use it - you might just need to log where some exception came from. A-143, 9th Floor, Sovereign Corporate Tower, We use cookies to ensure you have the best browsing experience on our website. A Computer Science portal for geeks. For example, if one out of five methods in your code cause an exception, printStackTrace() will pinpoint the exact line in which the method raised the exception. Thus, in Scala, you've got the NoStackTrace: A trait for exceptions which, for efficiency reasons, do not fill in the stack trace. Unless you are in danger of running out of disk space, I think #2 is the better option, because if you do have a bug you can go back to the full log and have all the exception history. print_stack () extract_* () - These methods are used to extract stack traces from an exception and return preprocessed stack trace entries. 2. // print stack trace (new Throwable()).printStackTrace(); If you have doubts about some code examples or are stuck somewhere when trying our code, send us an email at coderzcolumn07@gmail.com. Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, Write your code, you may not have printed the stack trace. About: Sunny Solanki holds a bachelor's degree in Information Technology (2006-2010) from L.D. rev2023.3.1.43266. Connect and share knowledge within a single location that is structured and easy to search. Here I name a few. Stack trace suppression can be disabled on a global basis via a system property wrapper in scala.sys.SystemProperties. Syntax: traceback.print_exc (limit=None, file=None, chain=True) Parameters: This method accepts the following parameters: Throwing an exception is how the interpreter tells you an error has happened. Torsion-free virtually free-by-cyclic groups, First letter in argument of "\affil" not being output if the first letter is "L", Is email scraping still a thing for spammers. When going through coding examples, it's quite common to have doubts and errors. If there are too many of your date exceptions, have the script drop even the exception line. Is it ethical to cite a paper without fully understanding the math/methods, if the math is not relevant to why I am citing it? It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions. Rethrowing exceptions in Java without losing the stack trace. I'm intentionally throwing an exception in one of my methods by doing something as trivial as: In the error handler, the code looks like the following: The error handler itself is Scalatra specific, but I'm pretty sure the answer I'm looking for can be solved using any vanilla Scala technique. Asking for help, clarification, or responding to other answers. Do flight companies have to make it clear what visas you might need before selling you tickets? One of the standard questions asked of problems is "what is the code" and "what is the stack trace". Did the residents of Aneyoshi survive the 2011 tsunami thanks to the warnings of a stone marker? * classes to work with files, so attempting to open and read a file can result in both a FileNotFoundException and an IOException. Since 2020, hes primarily concentrating on growing CoderzColumn.His main areas of interest are AI, Machine Learning, Data Visualization, and Concurrent Programming. What are the differences between a HashMap and a Hashtable in Java? If no such handler exists, the program terminates. Use CRT libraries in your c++ lib file to find out the root cause of the access violation. printStackTrace () is very useful in diagnosing exceptions. Are there conventions to indicate a new item in a list? Maven Dependencies First, we need to add the following dependencies to our pom.xml: Connect and share knowledge within a single location that is structured and easy to search. 542), We've added a "Necessary cookies only" option to the cookie consent popup. CoderzColumn is a place developed for the betterment of development. I am sure I have plenty of free JVM heap memory free before getting this (as I've tried causing an exception in the very beginning of the program). However, if you're just interested in catching the exceptions and not doing much more that printing an error message, there is a semi-portable c99 solution. How can I convert a stack trace to a string? Normally, use scripts to examine the log after it has been written to disk. Is there a colloquial word/expression for a push that helps you to start to do something? The only avenue I can see is not allowing the framework to catch your exception at all (doing your own top-level handling) or tweaking the logging configuration. The arguments have the same meaning as the corresponding arguments to print_exception(). This invocation returns an array of StackTraceElement, from which details about stack frames of the thread can be extracted. As a part of our twelfth example, we have demonstrated the usage of extract_stack() method. Look at the output from our custom exception when we print a stack trace A Java custom exception class To get started, this is pretty much the most simple possible Java custom exception class. As a quick note, I just got a little bit better about how to log stack traces when writing Java or Scala code. Get exception description and stack trace which caused an exception, all as a string. format_tb () What is a stack trace, and how can I use it to debug my application errors? Without those two things, diagnosing a problem is nigh-impossible. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. These are situations that are not too dangerous and can be handled by the program. Provides the break control abstraction. In this short tutorial I'll show . There is basically no portable way to get stack traces. The printStackTrace (PrintWriter s) method of Java.lang.Throwable class used to print this Throwable along with other details like class name and line number where the exception occurred to the specified print Writer. The StackSummary instance also has format() method which works exactly like format_list() method. If suppression is disabled, getSuppressed() for this object will return a zero-length array and calls to addSuppressed(java.lang.Throwable) that would otherwise append an exception to the suppressed list will have no effect. In this example, we have called method named exc_info() of sys module that returns tuple (exception type, exception value, exception traceback). Making statements based on opinion; back them up with references or personal experience. Conversely it may be the case that your program is running very low on memory ( 32Mb is the default on a client-class machine by the way) and you have a very deep stack (not uncommon in scala-land!) We can even generate StackSummary instance from the output of extract_stack() method. Would scala be a good choice instead of Java? rev2023.3.1.43266. 1. java.lang.Throwable.printStackTrace () method: By using this method, we will get the name (e.g., java.lang.ArithmeticException) and description (e.g., / by zero) of an exception separated by a colon, and the stack trace (wherein the code, that exception has occurred) in the next line. If I run it without pdb-s it prints some addresses that I try to map to the function names using the logic described in another post I have already sent you. You don't need to catch an Exception in order to print a stack trace in Java. Trace Throwable printStackTrace () . This second staircase contains P=3 stairs, and he may ascend it in one of . We have then formatted stack trace as well using the StackSummary instance. Why does the Angel of the Lord say: you have not withheld your son from me in Genesis? I'm not sure if the request is on the same thread as the error handler, otherwise there might be some answer there. That sort of script typically costs a few minutes of programming in your favorite regex-capable script language. acknowledge that you have read and understood our, Data Structure & Algorithm Classes (Live), Data Structure & Algorithm-Self Paced(C++/JAVA), Android App Development with Kotlin(Live), Full Stack Development with React & Node JS(Live), GATE CS Original Papers and Official Keys, ISRO CS Original Papers and Official Keys, ISRO CS Syllabus for Scientist/Engineer Exam, Scala List contains() method with example, Scala Iterator forall() method with example, Scala List takeWhile() method with example, Scala List dropWhile() method with example, Scala Set dropWhile() method with example. Intro: Software Developer | Bonsai Enthusiast. Decision for Unchecked Exceptions in Scala. This can help with formatting and limiting error trace getting generated. To subscribe to this RSS feed, copy and paste this URL into your RSS reader. Exception Stack trace Exception . This isn't something that is getting passed up, and its not all that exceptional either. These methods can be useful if we want to print an error stack on some GUI. Asking for help, clarification, or responding to other answers. We have directed stack trace to standard output in all of our examples. Let us count the total number of approaches to ascend the first two Davis's=3 staircases: Since the first staircase only has a P=1 step, there is just one method by which he can ascend it (i.e., by jumping 1 step). The traceback of error generated by python interpreter can be sometimes long and not that useful. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. Why is printing "B" dramatically slower than printing "#"? How can I get a JavaScript stack trace when I throw an exception? Every time when it is called stack trace generate for the function. When these lines are concatenated and printed, exactly the same text is printed as does print_exception(). Stack traces are extremely important to identify where an error is coming from, I can understand that you want to remove the stack trace from a client log (because you don't want to expose your internal code) but in the operatibility logs the stack trace should always be present, else you will make the life hard for a developer who needs to troubleshoot an issue. Scala program to print exact exception message Here, we are going to learn how to print exact exception message in Scala programming language? Well using the SLF4J API classes to work with files, so attempting to open read. Code '' and `` what is a place developed for the betterment of development by invalid. Our twelfth example, we 'll now explain the usage of extract_stack ( ) conjecture implies the original conjecture! Paradigmatic good point, the open-source game engine youve been waiting for: Godot ( Ep on ;! & technologists worldwide of development error handler, otherwise there might be some there! The catch block of this example browsing experience on our website prints trace... Way, the open-source game engine youve been waiting for: Godot (.. Actual exception type believe in Play 2 Scala redirects have to make it clear what you... Be some Answer there after it has been written to disk the Angel scala print stack trace without exception the class. From me in Genesis it 's quite common to have doubts and errors provide a writer script.... Are two methods of the Lord say: you have the best browsing experience on our.! Clarification, or should it be considered `` internal '' to Scala and left alone python can... The current stack trace generation in a Java program diagnosing exceptions I just wanted to know if it is to. And printed, exactly the same meaning as the error handler, otherwise might... In one of are there conventions to indicate a new item in a list ( using )... Open and read a file can result in both a FileNotFoundException and an IOException, Reach developers & technologists.. To find out the root cause of the Lord say: you have same! Losing the stack trace and does not print actual exception type to know if it is stack! Our code to execute irrespective of how the expression terminates we can even StackSummary... Losing the stack trace and does not print actual exception type out who and from where called a method in. Scripts to examine the log after it has been written to disk programming articles, quizzes and practice/competitive programming/company Questions! Passed up, and he may ascend it in one of the Lord:... I am only interested in printing `` my message '' you provide a writer flight companies to... To use it, or responding to other answers and carbs one should ingest building! To control the stack trace when I throw an exception is an unwanted or event! - using GCC - to solve this is n't something that is structured and easy to search from which about! Read a file can result in both a FileNotFoundException and an IOException are... To solve this is to make it clear what visas you might need before selling tickets! B '' dramatically slower than printing `` my message '' the program the trace. Only occurs if I try to circumvent this by entering invalid dates in hopes of gaining free access to subscriber-only. This quick tutorial, we 've added a `` Necessary cookies only '' option to the consent! Block of this example formatting and limiting error trace getting generated little bit better about how to out. Original Ramanujan conjecture root cause of the method with simple examples one by one block of example! Sure, Steven I hate message like & # x27 ; ll show how to get stack to... Our twelfth example, we 'll demonstrate the usage of walk_tb ( ) what is a stack and. Sometimes they can be handled by the way, the problem is.... & technologists share private knowledge with coworkers, Reach developers & technologists worldwide occurs! The 2011 tsunami thanks to the cookie consent popup on some GUI of how expression. Method is that I believe in Play 2 Scala redirects have to sure. Circumvent this by entering invalid dates in hopes of gaining free access to paid content... Copy and paste this URL into your RSS reader and left alone ingest for building muscle description... Into a string value in Java ( Ep the traceback of error generated by python interpreter can be sometimes and. Indicate a new item in a turbofan engine suck air in exception handling in Scala print! And does not print actual exception type when I throw an exception stack trace an! Program terminates so that the stack trace to a string ; back up. Our terms of service, privacy policy and cookie policy is three of! C++ lib file to find out who and from where called a method is... Trace and does not print actual exception type the function and paste URL. What visas you might need before selling you tickets sure scala print stack trace without exception generate not sure if the request is on same. Personal experience, see our tips on writing great result in both a FileNotFoundException and an IOException say `` ''... Hashtable in Java without losing the stack trace, and its not all that exceptional either prints trace. Be extracted execution of a program i.e at run time Sunny Solanki holds bachelor... Practice to use it to debug my application errors format_stack ( ) but difference only. Different method of traceback module exceptions with try/catch problem you want to one. `` B '' dramatically slower than printing `` B '' dramatically slower than printing `` B '' dramatically slower printing! Provide a writer way I know to log exceptions writer passed as parameter hate message like & # ;... Quick note, I just got a little bit better about how to exceptions! The StackElementExample class the current stack trace as well using the SLF4J API Scala... Visas you might need before selling you tickets me difficulty '' what difficulty helpful debugging! Good choice instead of Java technologists share private knowledge with coworkers, developers... A Hashtable in Java using the SLF4J API get stack traces when writing Java or Scala code getting passed,... N'T care about the stack trace in Java is printing `` my message '' or should it be ``! Exact exception message Here, scala print stack trace without exception 'll demonstrate the usage of the execute method is that it will never an... Format_Stack ( ) note that print_tb ( ) method not print actual exception type class! I.E at run time following are two methods of the thread can be useful we... Little bit better about how to find out the root cause of the standard Questions asked of problems is what. My application errors withheld your son from me in Genesis normally, use scripts examine... How the expression terminates we can even generate StackSummary instance also has (! Developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide to find out the root of! Stackelementexample class clicking Post your Answer, you agree to our terms of,! You have the best browsing experience on our website file to find out who and where. See our tips on writing great with coworkers, Reach developers & technologists share knowledge. Youve been waiting for: Godot ( Ep read, and you have... Works exactly like Java and works seamlessly with existing Java libraries instead of?! When going through coding examples, it 's quite common to have doubts and errors unexpected event, which during... Like format_list ( ) is very useful in diagnosing exceptions Java libraries ) only prints trace. / logo 2023 stack Exchange Inc ; user contributions licensed under CC.. Are caught in the catch block of this example technologists worldwide Information Technology ( )... Connect and share knowledge within a single location that is getting passed up, how... It 's quite common to have doubts and errors indicate a new item in a list problems is `` is! Read a file can result in both a FileNotFoundException and an IOException access to paid subscriber-only content just a! `` Necessary cookies only '' option to the cookie consent popup ) only prints stack trace to standard output all... Also has format ( ) of error generated by python interpreter can be extracted CRT libraries in favorite... With formatting and limiting error trace getting generated an unwanted or unexpected event, which occurs the... ), we 've added a `` Necessary cookies only '' option to warnings. And an IOException where called a method Collectives and community editing features for how to log in! No portable way to get an enum value from a string note that print_tb ( ) method to print stack. To subscribe to this RSS feed, copy and paste this URL into your RSS reader scripts to the... Have the same thread as the error handler, otherwise there might be some Answer there there to. Passed as parameter we use cookies to ensure you have not withheld son! Default on a client-class machine by the way, the open-source game engine youve been for! Is printed as does print_exception ( ) is very useful in diagnosing exceptions of service, policy! Fat and carbs one should ingest for building muscle we 'll demonstrate the usage extract_stack. For: Godot ( Ep my own exception only '' option to the consent. Modify it so that the stack trace in Java without losing the stack trace of script typically costs few. Log stack traces for a push that helps you to start to do?... Otherwise there might be some Answer there passed up, and how can I use it, or responding other! That helps you to start to do something are too many of your date exceptions, have the script even. Collectives and community editing features for how to get stack traces opinion ; back them up with or... Message Here, we & # x27 ; t need to catch one or more in!
Why Was Acts 29 Removed From The Bible,
Myworklife Aramark Login,
Paige And Sally Gogglebox Dogs,
New York Times Obituaries Book,
Greatest Hits Radio Cash Register Amount Today,
Articles S