<!DOCTYPE html><html lang='en'><head><title>[fs.class.filesystem_error]</title><meta charset='UTF-8'/><link rel='stylesheet' type='text/css' href='14882.css'/><link rel='stylesheet' type='text/css' href='expanded.css' title='Notes and examples expanded'/><link rel='alternate stylesheet' type='text/css' href='colored.css' title='Notes and examples colored'/><link rel='alternate stylesheet' type='text/css' href='collapsed.css' title='Notes and examples collapsed'/><link rel='icon' href='icon.png'/></head><body><div class='wrapper'><h1 ><a class='secnum' style='min-width:73pt'>28</a> Input/output library <a class='abbr_ref' href='./#input.output'>[input.output]</a></h1><h2 ><a class='secnum' style='min-width:88pt'>28.11</a> File systems <a class='abbr_ref' href='filesystems#fs.class.filesystem_error'>[filesystems]</a></h2><h3 ><a class='secnum' style='min-width:103pt'>28.11.8</a> Class <span class='texttt'>filesystem_&shy;error</span> <a class='abbr_ref'>[fs.class.filesystem_error]</a></h3><span class='indexparent'><a class='index' id='lib:filesystem_error'></a></span><pre class='codeblock'>
<span class='keyword'>namespace</span> std<span class='operator'>:</span><span class='operator'>:</span>filesystem <span class='curlybracket'>{</span>
  <span class='keyword'>class</span> filesystem_error <span class='operator'>:</span> <span class='keyword'>public</span> system_error <span class='curlybracket'>{</span>
  <span class='keyword'>public</span><span class='operator'>:</span>
    filesystem_error<span class='parenthesis'>(</span><span class='keyword'>const</span> string<span class='operator'>&amp;</span> what_arg, error_code ec<span class='parenthesis'>)</span>;
    filesystem_error<span class='parenthesis'>(</span><span class='keyword'>const</span> string<span class='operator'>&amp;</span> what_arg,
                     <span class='keyword'>const</span> path<span class='operator'>&amp;</span> p1, error_code ec<span class='parenthesis'>)</span>;
    filesystem_error<span class='parenthesis'>(</span><span class='keyword'>const</span> string<span class='operator'>&amp;</span> what_arg,
                     <span class='keyword'>const</span> path<span class='operator'>&amp;</span> p1, <span class='keyword'>const</span> path<span class='operator'>&amp;</span> p2, error_code ec<span class='parenthesis'>)</span>;

    <span class='keyword'>const</span> path<span class='operator'>&amp;</span> path1<span class='parenthesis'>(</span><span class='parenthesis'>)</span> <span class='keyword'>const</span> <span class='keyword'>noexcept</span>;
    <span class='keyword'>const</span> path<span class='operator'>&amp;</span> path2<span class='parenthesis'>(</span><span class='parenthesis'>)</span> <span class='keyword'>const</span> <span class='keyword'>noexcept</span>;
    <span class='keyword'>const</span> <span class='keyword'>char</span><span class='operator'>*</span> what<span class='parenthesis'>(</span><span class='parenthesis'>)</span> <span class='keyword'>const</span> <span class='keyword'>noexcept</span> <span class='keyword'>override</span>;
  <span class='curlybracket'>}</span>;
<span class='curlybracket'>}</span>
</pre><div class='para' id='1'><div class='marginalizedparent'><a class='marginalized' href='#1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/Eelis/draft73ca144c7e48612fe72742f9f6a5ec9ad6a934d2/source/iostreams.tex#L12920'>#</a></div><div id='1.sentence-1' class='sentence'>The class <span class='texttt'>filesystem_&shy;error</span> defines the type of
objects thrown as exceptions to report file system errors from functions described in this
subclause<a class='hidden_link' href='#1.sentence-1'>.</a></div></div><div id='fs.filesystem_error.members' class='section'><h4 ><a class='secnum' href='#fs.filesystem_error.members' style='min-width:118pt'>28.11.8.1</a> Members <a class='abbr_ref' href='fs.filesystem_error.members'>[fs.filesystem_error.members]</a></h4><div class='para' id='fs.filesystem_error.members-1'><div class='marginalizedparent'><a class='marginalized' href='#fs.filesystem_error.members-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/Eelis/draft73ca144c7e48612fe72742f9f6a5ec9ad6a934d2/source/iostreams.tex#L12927'>#</a></div><div id='fs.filesystem_error.members-1.sentence-1' class='sentence'>Constructors are provided that store zero, one, or two paths associated with
an error<a class='hidden_link' href='#fs.filesystem_error.members-1.sentence-1'>.</a></div> <span class='indexparent'><a class='index' id='lib:filesystem_error,constructor'></a></span></div><div class='itemdecl' id='fs.filesystem_error.members-itemdecl:1'><div class='marginalizedparent'><a class='itemDeclLink' href='#fs.filesystem_error.members-itemdecl:1'>🔗</a></div><code class='itemdeclcode'>filesystem_error<span class='parenthesis'>(</span><span class='keyword'>const</span> string<span class='operator'>&amp;</span> what_arg, error_code ec<span class='parenthesis'>)</span>;
</code></div><div class='itemdescr'></div><div class='para' id='fs.filesystem_error.members-2'><div class='marginalizedparent'><a class='marginalized' href='#fs.filesystem_error.members-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/Eelis/draft73ca144c7e48612fe72742f9f6a5ec9ad6a934d2/source/iostreams.tex#L12937'>#</a></div><div id='fs.filesystem_error.members-2.sentence-1' class='sentence'><span class='textit'>Ensures:</span> 
<ul class='itemize'><li id='fs.filesystem_error.members-2.1'><div class='marginalizedparent' style='left:-10em'><a class='marginalized' href='#fs.filesystem_error.members-2.1'>(2.1)</a></div><div id='fs.filesystem_error.members-2.1.sentence-1' class='sentence'><span class='texttt'>code<span class='parenthesis'>(</span><span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> ec</span>,</div></li><li id='fs.filesystem_error.members-2.2'><div class='marginalizedparent' style='left:-10em'><a class='marginalized' href='#fs.filesystem_error.members-2.2'>(2.2)</a></div><div id='fs.filesystem_error.members-2.2.sentence-1' class='sentence'><span class='texttt'>path1<span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='operator'>.</span>empty<span class='parenthesis'>(</span><span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> <span class='literal'>true</span></span>,</div></li><li id='fs.filesystem_error.members-2.3'><div class='marginalizedparent' style='left:-10em'><a class='marginalized' href='#fs.filesystem_error.members-2.3'>(2.3)</a></div><div id='fs.filesystem_error.members-2.3.sentence-1' class='sentence'><span class='texttt'>path2<span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='operator'>.</span>empty<span class='parenthesis'>(</span><span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> <span class='literal'>true</span></span>, and</div></li><li id='fs.filesystem_error.members-2.4'><div class='marginalizedparent' style='left:-10em'><a class='marginalized' href='#fs.filesystem_error.members-2.4'>(2.4)</a></div><div id='fs.filesystem_error.members-2.4.sentence-1' class='sentence'><span class='texttt'>string_&shy;view<span class='parenthesis'>(</span>what<span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span><span class='operator'>.</span>find<span class='parenthesis'>(</span>what_&shy;arg<span class='parenthesis'>)</span></span> <span class='texttt'><span class='operator'>!</span><span class='operator'>=</span> string_&shy;view<span class='operator'>:</span><span class='operator'>:</span>npos</span><a class='hidden_link' href='#fs.filesystem_error.members-2.4.sentence-1'>.</a></div></li></ul></div></div></div><span class='indexparent'><a class='index' id='lib:filesystem_error,constructor_'></a></span><div class='itemdecl' id='fs.filesystem_error.members-itemdecl:2'><div class='marginalizedparent'><a class='itemDeclLink' href='#fs.filesystem_error.members-itemdecl:2'>🔗</a></div><code class='itemdeclcode'>filesystem_error<span class='parenthesis'>(</span><span class='keyword'>const</span> string<span class='operator'>&amp;</span> what_arg, <span class='keyword'>const</span> path<span class='operator'>&amp;</span> p1, error_code ec<span class='parenthesis'>)</span>;
</code></div><div class='itemdescr'></div><div class='para' id='fs.filesystem_error.members-3'><div class='marginalizedparent'><a class='marginalized' href='#fs.filesystem_error.members-3'>3</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/Eelis/draft73ca144c7e48612fe72742f9f6a5ec9ad6a934d2/source/iostreams.tex#L12953'>#</a></div><div id='fs.filesystem_error.members-3.sentence-1' class='sentence'><span class='textit'>Ensures:</span> 
<ul class='itemize'><li id='fs.filesystem_error.members-3.1'><div class='marginalizedparent' style='left:-10em'><a class='marginalized' href='#fs.filesystem_error.members-3.1'>(3.1)</a></div><div id='fs.filesystem_error.members-3.1.sentence-1' class='sentence'><span class='texttt'>code<span class='parenthesis'>(</span><span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> ec</span>,</div></li><li id='fs.filesystem_error.members-3.2'><div class='marginalizedparent' style='left:-10em'><a class='marginalized' href='#fs.filesystem_error.members-3.2'>(3.2)</a></div><div id='fs.filesystem_error.members-3.2.sentence-1' class='sentence'><span class='texttt'>path1<span class='parenthesis'>(</span><span class='parenthesis'>)</span></span> returns a reference to the stored copy of <span class='texttt'>p1</span>,</div></li><li id='fs.filesystem_error.members-3.3'><div class='marginalizedparent' style='left:-10em'><a class='marginalized' href='#fs.filesystem_error.members-3.3'>(3.3)</a></div><div id='fs.filesystem_error.members-3.3.sentence-1' class='sentence'><span class='texttt'>path2<span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='operator'>.</span>empty<span class='parenthesis'>(</span><span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> <span class='literal'>true</span></span>, and</div></li><li id='fs.filesystem_error.members-3.4'><div class='marginalizedparent' style='left:-10em'><a class='marginalized' href='#fs.filesystem_error.members-3.4'>(3.4)</a></div><div id='fs.filesystem_error.members-3.4.sentence-1' class='sentence'><span class='texttt'>string_&shy;view<span class='parenthesis'>(</span>what<span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span><span class='operator'>.</span>find<span class='parenthesis'>(</span>what_&shy;arg<span class='parenthesis'>)</span></span> <span class='texttt'><span class='operator'>!</span><span class='operator'>=</span> string_&shy;view<span class='operator'>:</span><span class='operator'>:</span>npos</span><a class='hidden_link' href='#fs.filesystem_error.members-3.4.sentence-1'>.</a></div></li></ul></div></div></div><span class='indexparent'><a class='index' id='lib:filesystem_error,constructor__'></a></span><div class='itemdecl' id='fs.filesystem_error.members-itemdecl:3'><div class='marginalizedparent'><a class='itemDeclLink' href='#fs.filesystem_error.members-itemdecl:3'>🔗</a></div><code class='itemdeclcode'>filesystem_error<span class='parenthesis'>(</span><span class='keyword'>const</span> string<span class='operator'>&amp;</span> what_arg, <span class='keyword'>const</span> path<span class='operator'>&amp;</span> p1, <span class='keyword'>const</span> path<span class='operator'>&amp;</span> p2, error_code ec<span class='parenthesis'>)</span>;
</code></div><div class='itemdescr'></div><div class='para' id='fs.filesystem_error.members-4'><div class='marginalizedparent'><a class='marginalized' href='#fs.filesystem_error.members-4'>4</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/Eelis/draft73ca144c7e48612fe72742f9f6a5ec9ad6a934d2/source/iostreams.tex#L12969'>#</a></div><div id='fs.filesystem_error.members-4.sentence-1' class='sentence'><span class='textit'>Ensures:</span> 
<ul class='itemize'><li id='fs.filesystem_error.members-4.1'><div class='marginalizedparent' style='left:-10em'><a class='marginalized' href='#fs.filesystem_error.members-4.1'>(4.1)</a></div><div id='fs.filesystem_error.members-4.1.sentence-1' class='sentence'><span class='texttt'>code<span class='parenthesis'>(</span><span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> ec</span>,</div></li><li id='fs.filesystem_error.members-4.2'><div class='marginalizedparent' style='left:-10em'><a class='marginalized' href='#fs.filesystem_error.members-4.2'>(4.2)</a></div><div id='fs.filesystem_error.members-4.2.sentence-1' class='sentence'><span class='texttt'>path1<span class='parenthesis'>(</span><span class='parenthesis'>)</span></span> returns a reference to the stored copy of <span class='texttt'>p1</span>,</div></li><li id='fs.filesystem_error.members-4.3'><div class='marginalizedparent' style='left:-10em'><a class='marginalized' href='#fs.filesystem_error.members-4.3'>(4.3)</a></div><div id='fs.filesystem_error.members-4.3.sentence-1' class='sentence'><span class='texttt'>path2<span class='parenthesis'>(</span><span class='parenthesis'>)</span></span> returns a reference to the stored copy of <span class='texttt'>p2</span>, and</div></li><li id='fs.filesystem_error.members-4.4'><div class='marginalizedparent' style='left:-10em'><a class='marginalized' href='#fs.filesystem_error.members-4.4'>(4.4)</a></div><div id='fs.filesystem_error.members-4.4.sentence-1' class='sentence'><span class='texttt'>string_&shy;view<span class='parenthesis'>(</span>what<span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span><span class='operator'>.</span>find<span class='parenthesis'>(</span>what_&shy;arg<span class='parenthesis'>)</span></span> <span class='texttt'><span class='operator'>!</span><span class='operator'>=</span> string_&shy;view<span class='operator'>:</span><span class='operator'>:</span>npos</span><a class='hidden_link' href='#fs.filesystem_error.members-4.4.sentence-1'>.</a></div></li></ul></div></div></div><span class='indexparent'><a class='index' id='lib:path1,filesystem_error'></a></span><span class='indexparent'><a class='index' id='lib:filesystem_error,path1'></a></span><div class='itemdecl' id='fs.filesystem_error.members-itemdecl:4'><div class='marginalizedparent'><a class='itemDeclLink' href='#fs.filesystem_error.members-itemdecl:4'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>const</span> path<span class='operator'>&amp;</span> path1<span class='parenthesis'>(</span><span class='parenthesis'>)</span> <span class='keyword'>const</span> <span class='keyword'>noexcept</span>;
</code></div><div class='itemdescr'></div><div class='para' id='fs.filesystem_error.members-5'><div class='marginalizedparent'><a class='marginalized' href='#fs.filesystem_error.members-5'>5</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/Eelis/draft73ca144c7e48612fe72742f9f6a5ec9ad6a934d2/source/iostreams.tex#L12985'>#</a></div><div id='fs.filesystem_error.members-5.sentence-1' class='sentence'><span class='textit'>Returns:</span> A reference to the copy of <span class='texttt'>p1</span> stored by the
  constructor, or, if none, an empty path<a class='hidden_link' href='#fs.filesystem_error.members-5.sentence-1'>.</a></div></div></div><span class='indexparent'><a class='index' id='lib:path2,filesystem_error'></a></span><span class='indexparent'><a class='index' id='lib:filesystem_error,path2'></a></span><div class='itemdecl' id='fs.filesystem_error.members-itemdecl:5'><div class='marginalizedparent'><a class='itemDeclLink' href='#fs.filesystem_error.members-itemdecl:5'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>const</span> path<span class='operator'>&amp;</span> path2<span class='parenthesis'>(</span><span class='parenthesis'>)</span> <span class='keyword'>const</span> <span class='keyword'>noexcept</span>;
</code></div><div class='itemdescr'></div><div class='para' id='fs.filesystem_error.members-6'><div class='marginalizedparent'><a class='marginalized' href='#fs.filesystem_error.members-6'>6</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/Eelis/draft73ca144c7e48612fe72742f9f6a5ec9ad6a934d2/source/iostreams.tex#L12996'>#</a></div><div id='fs.filesystem_error.members-6.sentence-1' class='sentence'><span class='textit'>Returns:</span> A reference to the copy of <span class='texttt'>p2</span> stored by the
  constructor, or, if none, an empty path<a class='hidden_link' href='#fs.filesystem_error.members-6.sentence-1'>.</a></div></div></div><span class='indexparent'><a class='index' id='lib:what,filesystem_error'></a></span><span class='indexparent'><a class='index' id='lib:filesystem_error,what'></a></span><div class='itemdecl' id='fs.filesystem_error.members-itemdecl:6'><div class='marginalizedparent'><a class='itemDeclLink' href='#fs.filesystem_error.members-itemdecl:6'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>const</span> <span class='keyword'>char</span><span class='operator'>*</span> what<span class='parenthesis'>(</span><span class='parenthesis'>)</span> <span class='keyword'>const</span> <span class='keyword'>noexcept</span> <span class='keyword'>override</span>;
</code></div><div class='itemdescr'></div><div class='para' id='fs.filesystem_error.members-7'><div class='marginalizedparent'><a class='marginalized' href='#fs.filesystem_error.members-7'>7</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/Eelis/draft73ca144c7e48612fe72742f9f6a5ec9ad6a934d2/source/iostreams.tex#L13007'>#</a></div><div id='fs.filesystem_error.members-7.sentence-1' class='sentence'><span class='textit'>Returns:</span> An <span class='textsc'>ntbs</span> that incorporates
  the <span class='texttt'>what_&shy;arg</span> argument supplied to the constructor<a class='hidden_link' href='#fs.filesystem_error.members-7.sentence-1'>.</a></div> <div id='fs.filesystem_error.members-7.sentence-2' class='sentence'>The exact format is unspecified<a class='hidden_link' href='#fs.filesystem_error.members-7.sentence-2'>.</a></div> <div id='fs.filesystem_error.members-7.sentence-3' class='sentence'>Implementations should include
  the <span class='texttt'>system_&shy;error<span class='operator'>:</span><span class='operator'>:</span>what<span class='parenthesis'>(</span><span class='parenthesis'>)</span></span> string and
  the pathnames of <span class='texttt'>path1</span> and <span class='texttt'>path2</span>
  in the native format in the returned string<a class='hidden_link' href='#fs.filesystem_error.members-7.sentence-3'>.</a></div></div></div></div></div></body></html>